reader_writer_lock 0.1.0 reader_writer_lock: ^0.1.0 copied to clipboard
Simple reader-writer-lock implementation upon mutex package
reader_writer_lock #
Simple reader-writer-lock implementation upon mutex package.
Usage #
The package realizes synchronized like syntax to reduce use of try-finally
for releasing locks.
import 'package:reader_writer_lock/reader_writer_lock.dart';
final rwlock = ReaderWriterLock();
// reader-lock
await rwlock.readerLock(() async {
// Do reader task here
});
// writer-lock
await rwlock.writerLock(() async {
// Do writer task here
});