Skip to main content

Crate ksync

Crate ksync 

Source

Re-exports§

pub use pin_init;

Macros§

declare_interned_string
Statically declares a new InternedString.
declare_singleton_critical_mutex
Declares a singleton critical mutex (disables interrupts/preemption while held).
declare_singleton_lock
declare_singleton_monitored_spinlock
Declares a singleton monitored spinlock (integrated with the kernel lockup detector).
declare_singleton_mutex
Declares a singleton mutex.
declare_singleton_spinlock
Declares a singleton spinlock.
lock
Locks a mutex.
source_tag
Expands to a SourceTag containing the file path and line number ("file:line") of the call site, equivalent to C++ SOURCE_TAG.

Structs§

AliasedLock
Type tag to indicate aliased lock acquisition.
BrwLockPi
A priority-inheriting reader-writer lock.
BrwLockPiReadGuard
A validation guard representing reader lock ownership and active list participation.
BrwLockPiWriteGuard
A validation guard representing writer lock ownership and active list participation.
InterruptSavedState
Opaque token representing the saved interrupt state.
IrqSavePolicy
KCell
A container cell that safe-guards data of type T using type-level lock class tracking.
KCellInit
Initializer for KCell.
KMutex
A safe, Zircon-compatible mutual exclusion lock supporting compile-time order validation.
KMutexAliasedGuard
A validation guard representing ownership of two aliased locks simultaneously.
KMutexGuard
A validation guard representing exclusive lock ownership and active list participation.
KMutexGuardMultiple
Guards simultaneous acquisitions of multiple locks of the same class and type.
KOnceCell
A cell that provides lazy/one-time initialization synchronized by a lock class Class.
KOnceCellGuard
A safe RAII / proxy guard providing synchronized access to a KOnceCell protected by a lock.
LockClassRegistration
A registration entry for a Rust lock class (stub for disabled lockdep).
LockToken
A token proving that a lock of lock class Class is currently held by the current thread.
LockdepTracked
Wraps a RawLock and LockPolicy with optional lockdep tracking state.
LockdepTrackedGuardState
Guard state for a LockdepTracked lock acquisition, combining lockdep’s stack entry storage with the underlying policy’s GuardState.
MonitoredSpinlockGuardState
Saved interrupt state and source tag for a held RawMonitoredSpinlock.
NoIrqSavePolicy
PhantomMutex
A zero-sized raw mutex marker that does not perform physical locking.
RawBrwLockPiReadPolicy
Policy for acquiring and releasing a RawBrwLockPiStorage in shared (read) mode.
RawBrwLockPiStorage
Opaque layout block matching the Zircon C++ BrwLockPi object.
RawBrwLockPiWritePolicy
Policy for acquiring and releasing a RawBrwLockPiStorage in exclusive (write) mode.
RawCriticalMutexPolicy
Lock policy for acquiring and releasing a RawMutexStorage as a C++ CriticalMutex.
RawMonitoredSpinlockStorage
Opaque layout block for the Zircon C++ MonitoredSpinLock object.
RawMutexStorage
Opaque layout block matching the Zircon C++ Mutex (and CriticalMutex) object.
RawSpinlockStorage
Opaque layout block for the Zircon C++ SpinLock object.
SourceTag
A static C-string tag identifying the source location ("file:line") where a lock is acquired.

Constants§

LOCK_FLAGS_MULTI_ACQUIRE
Apply the multi-acquire rules in additioon to the common rules for all locks.
LOCK_FLAGS_SINGLETON_LOCK
There is only one member of this locks class.

Traits§

ConstRawLock
Trait for RawLock types that can be statically initialized in a const context (e.g. for global singleton locks).
ExclusiveLockPolicy
Marker subtrait for LockPolicy implementations that enforce exclusive mutual exclusion.
ExclusiveLockToken
Trait for lock guard types bound to a Parent struct instance that hold exclusive ownership of a lock of class Class and can yield a mutable LockToken.
LockClass
Trait implemented by lock class types to expose their dynamic LockClassId pointer.
LockPolicy
Trait defining a policy for how a lock should be acquired and released. A given RawLock may have multiple policy implementations allowing a specific instance of a lock to be acquired, at different times, in different ways.
LockTokenRead
Trait implemented by lock tokens that grant shared (read) access to a cell guarded by Class.
LockTokenWrite
Trait implemented by lock tokens that grant exclusive (write) access to a cell guarded by Class.
RawLock
Trait defining a raw, un-instrumented synchronization lock abstraction.

Functions§

aliased_lock
Acquires an aliased lock on two KMutex instances that reference the same underlying lock.
aliased_lock_policy
Acquires an aliased lock with a specific policy on two KMutex instances that reference the same underlying lock.
aliased_lock_policy_with
Acquires an aliased lock with a specific policy and arguments on two KMutex instances that reference the same underlying lock.
aliased_lock_with
Acquires an aliased lock with arguments on two KMutex instances that reference the same underlying lock.
guard_multiple
Acquires multiple KMutex instances of the same class and type in ascending memory address order, using the default policy.
guard_multiple_policy
Acquires multiple KMutex instances of the same class and type in ascending memory address order, using policy P.
guard_multiple_policy_with
Acquires multiple KMutex instances of the same class and type in ascending memory address order with policy P and arguments.
guard_multiple_with
Acquires multiple KMutex instances of the same class and type in ascending memory address order with arguments, using the default policy.
kcell_init
Creates an initializer wrapper for initializing a KCell with an inner Init or PinInit initializer.

Type Aliases§

KMonitoredSpinlock
KSpinlock
LockFlags
Flags to specify which rules to apply to a lock class during validation.
RawBrwLockPi
Lockdep-tracked kernel BrwLockPi matching the Zircon C++ Lock<BrwLockPi> layout.
RawCriticalMutex
Lockdep-tracked kernel critical mutex matching the Zircon C++ Lock<CriticalMutex> layout.
RawMonitoredSpinlock
Lockdep-tracked kernel monitored spinlock matching the Zircon C++ Lock<MonitoredSpinLock> layout.
RawMutex
Lockdep-tracked kernel mutex matching the Zircon C++ Lock<Mutex> layout.
RawSpinlock
Lockdep-tracked kernel spinlock matching the Zircon C++ Lock<SpinLock> layout.
SingletonMutex
A statically initialized global singleton mutex.

Attribute Macros§

guarded
Instruments a struct with lock-class registration, KCell/KOnceCell field wrapping, and type-safe lock guard accessors.