struct RecursiveLock {
lock: Option<FileLock>,
count: u32,
is_exclusive: bool,
filename: &'static str,
}
Expand description
A file lock, with a counter to assist with recursive locking.
Fields§
§lock: Option<FileLock>
The file lock.
An important note is that locks can be None
even when they are held.
This can happen on things like old NFS mounts where locking isn’t
supported. We otherwise pretend we have a lock via the lock count. See
FileLock
for more detail on that.
count: u32
Number locks held, to support recursive locking.
is_exclusive: bool
If this is true
, it is an exclusive lock, otherwise it is shared.
filename: &'static str
The filename of the lock.
Implementations§
Source§impl RecursiveLock
impl RecursiveLock
fn new(filename: &'static str) -> RecursiveLock
Acquires a shared lock.
Acquires a shared lock, blocking if held by another locker.
Acquires a shared lock, returns WouldBlock
if held by another locker.
Sourcefn lock_exclusive(
&mut self,
gctx: &GlobalContext,
description: &'static str,
blocking: BlockingMode,
) -> CargoResult<LockingResult>
fn lock_exclusive( &mut self, gctx: &GlobalContext, description: &'static str, blocking: BlockingMode, ) -> CargoResult<LockingResult>
Acquires an exclusive lock.
Sourcefn lock_exclusive_blocking(
&mut self,
gctx: &GlobalContext,
description: &'static str,
) -> CargoResult<()>
fn lock_exclusive_blocking( &mut self, gctx: &GlobalContext, description: &'static str, ) -> CargoResult<()>
Acquires an exclusive lock, blocking if held by another locker.
Sourcefn lock_exclusive_nonblocking(
&mut self,
gctx: &GlobalContext,
) -> CargoResult<LockingResult>
fn lock_exclusive_nonblocking( &mut self, gctx: &GlobalContext, ) -> CargoResult<LockingResult>
Acquires an exclusive lock, returns WouldBlock
if held by another locker.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RecursiveLock
impl RefUnwindSafe for RecursiveLock
impl Send for RecursiveLock
impl Sync for RecursiveLock
impl Unpin for RecursiveLock
impl UnwindSafe for RecursiveLock
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 56 bytes