Mojo struct
BlockingScopedLock
A scope adapter for BlockingSpinLock.
Aliasesβ
LockType = BlockingSpinLock
: The type of the lock.
Fieldsβ
- βlock (
UnsafePointer[BlockingSpinLock, 0, 0, alignof[::AnyType,__mlir_type.!kgen.target]() if triple_is_nvidia_cuda() else 1]
): The underlying lock instance.
Implemented traitsβ
AnyType
Methodsβ
__init__
β
__init__(inout self: Self, lock: UnsafePointer[BlockingSpinLock, 0, 0, alignof[::AnyType,__mlir_type.!kgen.target]() if triple_is_nvidia_cuda() else 1])
Primary constructor.
Args:
- βlock (
UnsafePointer[BlockingSpinLock, 0, 0, alignof[::AnyType,__mlir_type.!kgen.target]() if triple_is_nvidia_cuda() else 1]
): A pointer to the underlying lock.
__init__(inout self: Self, inout lock: BlockingSpinLock)
Secondary constructor.
Args:
- βlock (
BlockingSpinLock
): A mutable reference to the underlying lock.
__enter__
β
__enter__(inout self: Self)
Acquire the lock on entry. This is done by setting the owner of the lock to own address.
__exit__
β
__exit__(inout self: Self)
Release the lock on exit. Reset the address on the underlying lock.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
If you'd like to share more information, please report an issue on GitHub
π What went wrong?