Sha256: 8794269a3533d01672d8672a3210a254ebec66471247305eefb66b46d2110c14

Contents?: true

Size: 828 Bytes

Versions: 8

Compression:

Stored size: 828 Bytes

Contents

use std::io;

use crate::sys::Selector;
use crate::Token;

/// Waker backed by kqueue user space notifications (`EVFILT_USER`).
///
/// The implementation is fairly simple, first the kqueue must be setup to
/// receive waker events this done by calling `Selector.setup_waker`. Next
/// we need access to kqueue, thus we need to duplicate the file descriptor.
/// Now waking is as simple as adding an event to the kqueue.
#[derive(Debug)]
pub(crate) struct Waker {
    selector: Selector,
    token: Token,
}

impl Waker {
    pub(crate) fn new(selector: &Selector, token: Token) -> io::Result<Waker> {
        let selector = selector.try_clone()?;
        selector.setup_waker(token)?;
        Ok(Waker { selector, token })
    }

    pub(crate) fn wake(&self) -> io::Result<()> {
        self.selector.wake(self.token)
    }
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/mio-1.0.3/src/sys/unix/waker/kqueue.rs
wasmtime-28.0.0 ./ext/cargo-vendor/mio-1.0.3/src/sys/unix/waker/kqueue.rs
wasmtime-27.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/waker/kqueue.rs
wasmtime-26.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/waker/kqueue.rs
wasmtime-25.0.2 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/waker/kqueue.rs
wasmtime-25.0.1 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/waker/kqueue.rs
wasmtime-25.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/waker/kqueue.rs
wasmtime-24.0.0 ./ext/cargo-vendor/mio-1.0.2/src/sys/unix/waker/kqueue.rs