Mojo struct
BlockingSpinLock
struct BlockingSpinLock
A basic locking implementation that uses an integer to represent the owner of the lock.
Fields
- counter (Atomic[DType.int64]): The atomic counter implementing the spin lock.
Implemented traits
AnyType,
Defaultable,
UnknownDestructibility
Aliases
__del__is_trivial
alias __del__is_trivial = Atomic[DType.int64].__del__is_trivial
UNLOCKED
alias UNLOCKED = -1
non-zero means locked, -1 means unlocked.
Methods
__init__
__init__(out self)
Default constructor.
lock
lock(mut self, owner: Int)
Acquires the lock.
Args:
- owner (Int): The lock's owner (usually an address).
unlock
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
