read method

Future read()

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 withReadLock, 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 read() => _acquire(isRead: true);