Trait Level

Source
pub trait Level { }
Expand description

Lock level of a mutex

While a mutex of L1 is locked on a thread, only mutexes of L2 or higher may be locked. This lock hierarchy prevents deadlocks from occurring. For a dead lock to occour We need some thread TA to hold a resource RA, and request a resource RB, while another thread TB holds RB, and requests RA. This is not possible with a lock hierarchy either RA or RB must be on a level that the other.

At some point in time we would want Level to be replaced by usize, however with current cont generics (rust 1.55), we cannot compare const generic arguments so we are left with this mess.

Implementors§

Source§

impl Level for L0

Source§

impl Level for L1

Source§

impl Level for L2

Source§

impl Level for L3

Source§

impl Level for L4

Source§

impl Level for L5