pub struct SnatchLock {
lock: RwLock<()>,
}
Expand description
A Device-global lock for all snatchable data.
Fields§
§lock: RwLock<()>
Implementations§
Source§impl SnatchLock
impl SnatchLock
Sourcepub unsafe fn new(rank: LockRank) -> Self
pub unsafe fn new(rank: LockRank) -> Self
The safety of Snatchable::get
and Snatchable::snatch
rely on their using of the
right SnatchLock (the one associated to the same device). This method is unsafe
to force force sers to think twice about creating a SnatchLock. The only place this
method should be called is when creating the device.
Sourcepub fn read(&self) -> SnatchGuard<'_>
pub fn read(&self) -> SnatchGuard<'_>
Request read access to snatchable resources.
Sourcepub fn write(&self) -> ExclusiveSnatchGuard<'_>
pub fn write(&self) -> ExclusiveSnatchGuard<'_>
Request write access to snatchable resources.
This should only be called when a resource needs to be snatched. This has a high risk of causing lock contention if called concurrently with other wgpu work.
pub unsafe fn force_unlock_read(&self, data: RankData)
Auto Trait Implementations§
impl !Freeze for SnatchLock
impl !RefUnwindSafe for SnatchLock
impl Send for SnatchLock
impl Sync for SnatchLock
impl Unpin for SnatchLock
impl UnwindSafe for SnatchLock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more