lock method

Future lock()

Acquire a lock

Returns a future that will be completed when the lock has been acquired.

Consider using the convenience method withLock, otherwise the caller is responsible for making sure the lock is released after it is no longer needed. Failure to release the lock means no other code can acquire the lock.

Implementation

Future lock() => _rwMutex.write();