pub struct EpollManager {
    pub mgr: Arc<Mutex<EventManager<EpollSubscriber>>>,
    /* private fields */
}
Expand description

A wrapper struct over EventManager to solve possible deadlock.

It’s a rather tough topic to deal with the epoll event manager in rust way. The event_manager::EventManager is designed for single-threaded environment and it leaves the task for concurrent access to the clients. There are two types of threads involved, epoll worker thread and vCPU threads. To reduce overhead, the epoll worker thread calls epoll::wait() without timeout, so the worker thread will hold the EpollManagerImpl::Mutex for undetermined periods. When the vCPU threads tries to activate virtio devices, they need to acquire the same EpollManagerImpl::Mutex. Thus the vCPU threads may block for an undetermined time. To solve this issue, we perform an kick()/try_lock() loop to wake up the epoll worker thread from sleeping.

Fields

mgr: Arc<Mutex<EventManager<EpollSubscriber>>>

Implementations

Add a new epoll event subscriber.

Remove a given epoll event subscriber.

Add an epoll event to be monitored.

Run the epoll polling loop.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Create a new epoll manager.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. 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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.