IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

BlockingScopedLock

struct BlockingScopedLock[origin: MutOrigin, //]

A scope adapter for BlockingSpinLock.

Fields​

  • ​lock (Pointer[BlockingSpinLock, origin]): The underlying lock instance.

Implemented traits​

AnyType, Deinitable, Movable

comptime members​

LockType​

comptime LockType = BlockingSpinLock

The type of the lock.

Methods​

__init__​

def __init__(out self, lock: Pointer[BlockingSpinLock, origin])

Primary constructor.

Args:

def __init__(out self, ref[origin] lock: BlockingSpinLock)

Secondary constructor.

Args:

__enter__​

def __enter__(mut self)

Acquire the lock on entry. This is done by setting the owner of the lock to own address.

__exit__​

def __exit__(mut self)

Release the lock on exit. Reset the address on the underlying lock.