Struct wgpu_core::snatch::SnatchLock
source · 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.
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