get_mutex 1.0.0 copy "get_mutex: ^1.0.0" to clipboard
get_mutex: ^1.0.0 copied to clipboard

Robust, efficient, and deadlock-free synchronization in Dart. Concurrency made simple, without sacrificing performance.

example/example.md

void main(){
    final mutex = Mutex();
    final executionOrder = <int>[];
      await mutex.protect(() async {
        executionOrder.add(1);
            await mutex.protect(() async {
            executionOrder.add(2);
            await mutex.protect(() async {
                executionOrder.add(3);
            });
            executionOrder.add(4);
            });
            executionOrder.add(5);
        });
        executionOrder.add(6);

        if(executionOrder.toString() == [1, 2, 3, 4, 5, 6].toString()) {
            print('All good!');
        } else {
            throw Exception('Fail :('); // This will never happen
        }
      }
2
likes
140
points
36
downloads

Publisher

unverified uploader

Weekly Downloads

Robust, efficient, and deadlock-free synchronization in Dart. Concurrency made simple, without sacrificing performance.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on get_mutex