Trait RawMutexFair
pub unsafe trait RawMutexFair: RawMutex
Additional methods for mutexes which support fair unlocking.
Fair unlocking means that a lock is handed directly over to the next waiting thread if there is one, without giving other threads the opportunity to "steal" the lock in the meantime. This is typically slower than unfair unlocking, but may be necessary in certain circumstances.
Required Methods
unsafe fn unlock_fair(&self)Unlocks this mutex using a fair unlock protocol.
Safety
This method may only be called if the mutex is held in the current context, see the documentation of
unlock.
Provided Methods
unsafe fn bump(&self)Temporarily yields the mutex to a waiting thread if there is one.
This method is functionally equivalent to calling
unlock_fairfollowed bylock, however it can be much more efficient in the case where there are no waiting threads.Safety
This method may only be called if the mutex is held in the current context, see the documentation of
unlock.