Function nrfxlib::poll[][src]

pub fn poll(
    poll_list: &mut [PollEntry<'_>],
    timeout_ms: u16
) -> Result<i32, Error>
Expand description

Poll on multiple sockets at once.

For example:

use nrfxlib::{at::AtSocket, gnss::GnssSocket, Pollable, PollFlags, PollResult};
let mut socket1 = AtSocket::new();
let mut socket2 = GnssSocket::new();
let mut poll_list = [
    PollEntry::new(&mut socket1, PollFlags::Read),
    PollEntry::new(&mut socket2, PollFlags::Read),
];
match nrfxlib::poll(&mut poll_list, 100) {
    Ok(0) => {
        // Timeout
    }
    Ok(n) => {
        // One of the sockets is ready. See `poll_list[n].result()`.
    }
    Err(e) => {
        // An error occurred
    }
}