acquireRead method

Future acquireRead()

Acquire a read lock

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

A read lock can not be acquired when there is a write lock on the mutex. But it can be acquired if there are other read locks.

Consider using the convenience method protectRead, 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 a write lock.

Implementation

Future acquireRead() => _acquire(isRead: true);