struct CriticalSection {
_file: File,
}Expand description
A held per-instance_id OS advisory lock. Blocking (waits rather
than failing immediately) — critical sections here are a handful of
small file ops, so worst-case wait time is negligible. Released
automatically on drop: closing the underlying handle releases both
flock (Unix) and LockFileEx (Windows) advisory locks.
Fields§
§_file: FileImplementations§
Source§impl CriticalSection
impl CriticalSection
Sourcefn enter(lock_path: &Path) -> Result<Self>
fn enter(lock_path: &Path) -> Result<Self>
Deliberately never removes lock_path — one empty lock file
persists per instance_id that has ever called claim, same
bounded/accepted cost as backend::base::MuxLock’s single
global lock file. This is NOT an oversight: deleting a flock/
LockFileEx-locked file out from under a waiter is the classic
“unlink race” footgun — a process blocked in open() (before
it gets to actually lock) can end up holding a handle to a
different underlying file than a fresh claimant that
recreated the path after deletion, so both would believe they
hold “the” lock while actually holding two distinct advisory
locks on two distinct inodes. Leaving the lock file in place
forever avoids that hazard entirely at the cost of a handful of
permanently-empty files.
Auto Trait Implementations§
impl Freeze for CriticalSection
impl RefUnwindSafe for CriticalSection
impl Send for CriticalSection
impl Sync for CriticalSection
impl Unpin for CriticalSection
impl UnsafeUnpin for CriticalSection
impl UnwindSafe for CriticalSection
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more