hermit::fd

Function eventfd

Source
pub fn eventfd(initval: u64, flags: EventFlags) -> Result<i32>
Expand description

Wait for some event on a file descriptor.

eventfd creates an linux-like “eventfd object” that can be used as an event wait/notify mechanism by user-space applications, and by the kernel to notify user-space applications of events. The object contains an unsigned 64-bit integer counter that is maintained by the kernel. This counter is initialized with the value specified in the argument initval.

As its return value, eventfd returns a new file descriptor that can be used to refer to the eventfd object.

The following values may be bitwise set in flags to change the behavior of eventfd:

EFD_NONBLOCK: Set the file descriptor in non-blocking mode EFD_SEMAPHORE: Provide semaphore-like semantics for reads from the new file descriptor.