You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO since we're not using crossbeam channel's recv(), we don't get
// the benefit of yielding the thread when the channel is empty.
// Performance opportunities:
// - implement or use crossbeam's Backoff to yield the thread or spin
// when the channel is empty
// - park the thread and use signal mechanism to wake up the thread when
// there's a new task
The text was updated successfully, but these errors were encountered:
Looking through the Tokio codebase, it seems like the parking mechanism is actually implemented by the I/O driver or the timer driver. If neither driver is enabled, Tokio will fall back to parking the thread using a condition variable or thread parking.
If the I/O driver is enabled, it uses Linux's epoll syscall with a timeout parameter to park the thread until a point where a timer entry needs to be woken up (this is useful for our ongoing implementation of wheel timer). If there's a new task before the timer expires, Tokio will manually fire a fake (?) I/O event to make epoll return.
If the I/O driver is not enabled but the timer driver is, the timer driver will park the thread using a condition variable, similarly with a timeout of the duration until the next timer entry expires.
The text was updated successfully, but these errors were encountered: