pub struct LockRank {
pub(super) bit: LockRankSet,
pub(super) followers: LockRankSet,
}Expand description
The rank of a lock.
Each Mutex, RwLock, and SnatchLock in wgpu-core has been
assigned a rank: a node in the DAG defined at the bottom of
wgpu-core/src/lock/rank.rs. The rank of the most recently
acquired lock you are still holding determines which locks you may
attempt to acquire next.
When you create a lock in wgpu-core, you must specify its rank
by passing in a LockRank value. This module declares a
pre-defined set of ranks to cover everything in wgpu-core, named
after the type in which they occur, and the name of the type’s
field that is a lock. For example, CommandBuffer::data is a
Mutex, and its rank here is the constant
COMMAND_BUFFER_DATA.
Fields§
§bit: LockRankSetThe bit representing this lock.
There should only be a single bit set in this value.
followers: LockRankSetA bitmask of permitted successor ranks.
If rank is the rank of the most recently acquired lock we
are still holding, then rank.followers is the mask of
locks we are allowed to acquire next.
The define_lock_ranks! macro ensures that there are no
cycles in the graph of lock ranks and their followers.