pub(crate) struct EventFd {
    event_handle: SafeDescriptor,
}
Expand description

A safe wrapper around a Linux eventfd (man 2 eventfd).

An eventfd is useful because it is sendable across processes and can be used for signaling in and out of the KVM API. They can also be polled like any other file descriptor.

Fields

event_handle: SafeDescriptor

Implementations

Creates a new blocking EventFd with an initial value of 0.

Adds v to the eventfd’s count, blocking until this won’t overflow the count.

Blocks until the the eventfd’s count is non-zero, then resets the count to zero.

Blocks for a maximum of timeout duration until the the eventfd’s count is non-zero. If a timeout does not occur then the count is returned as a EventReadResult::Count(count), and the count is reset to 0. If a timeout does occur then this function will return EventReadResult::Timeout.

Clones this EventFd, internally creating a new file descriptor. The new EventFd will share the same underlying count within the kernel.

Trait Implementations

Returns the underlying raw descriptor. Read more

Extracts the raw file descriptor. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Safety Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Returns the underlying raw descriptors. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.