pub struct RecoverableMutex<T> {
inner: Mutex<T>,
holder: AtomicI16,
}Fields§
§inner: Mutex<T>§holder: AtomicI16保持中のコア ID(FREE = 未保持)。
Implementations§
Source§impl<T> RecoverableMutex<T>
impl<T> RecoverableMutex<T>
pub const fn new(value: T) -> Self
Sourcepub fn try_lock(&self) -> Option<RecGuard<'_, T>>
pub fn try_lock(&self) -> Option<RecGuard<'_, T>>
取得を試み、すでにロック中なら None を返す(デッドロックしない。検証/回復確認用)。
Sourcepub unsafe fn force_release_if_core(&self, cid: i16)
pub unsafe fn force_release_if_core(&self, cid: i16)
パニック回復専用: コア cid が保持中ならロックを強制解放する。
§Safety
呼び出し元(パニックハンドラ)は、コア cid の現在の実行が直後に破棄される
(scheduler::exit() で別プロセスへ切替わる)ことを保証すること。保持していた
クリティカルセクションの不変条件は失われる前提で呼ぶ。
Trait Implementations§
impl<T: Send> Send for RecoverableMutex<T>
impl<T: Send> Sync for RecoverableMutex<T>
Auto Trait Implementations§
impl<T> !Freeze for RecoverableMutex<T>
impl<T> !RefUnwindSafe for RecoverableMutex<T>
impl<T> Unpin for RecoverableMutex<T>where
T: Unpin,
impl<T> UnsafeUnpin for RecoverableMutex<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for RecoverableMutex<T>where
T: UnwindSafe,
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