momotor.shared.exlock#

Implementation of an exclusive lock.

A subclass of aiorwlock.RWLock

Class documentation#

class momotor.shared.exlock.ExLock(*, fast=False)#

A subclass of aiorwlock.RWLock

An ExLock maintains a pair of associated locks, one for read-only operations and one for writing. The read lock may be held simultaneously by multiple reader tasks, so long as there are no writers. The write lock is exclusive.

get(exclusive)#

Get either the reader or writer lock, depending on the value of exclusive

Parameters:

exclusive (bool) – if False, requests the reader lock, otherwise the writer lock

Return type:

_ReaderLock | _WriterLock

Returns:

the requested lock

property reader: _ReaderLock#

The lock used for read, or shared, access

property reader_lock: _ReaderLock#

The lock used for read, or shared, access

property writer: _WriterLock#

The lock used for write, or exclusive, access

property writer_lock: _WriterLock#

The lock used for write, or exclusive, access