vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Class TaskReadWriteMutex

A ReadWriteMutex implementation for fibers.

class TaskReadWriteMutex ;

This mutex can be used in exchange for a core.sync.mutex.ReadWriteMutex, but does not block the event loop in contention situations. The reader and writer members are used for locking. Locking the reader mutex allows access to multiple readers at once, while the writer mutex only allows a single writer to lock it at any given time. Locks on reader and writer are mutually exclusive (i.e. whenever a writer is active, no readers can be active at the same time, and vice versa).

Constructors

NameDescription
this (policy)

Fields

NameTypeDescription
reader TaskReadWriteMutex.Mutex!(0)
writer TaskReadWriteMutex.Mutex!(1)

Properties

NameTypeDescription
policy[get] vibe.core.sync.ReadWriteMutexState!(false)The policy with which the lock has been created.

Inner classes

NameDescription
Mutex A common baseclass for both of the provided mutexes.

Aliases

NameDescription
Policy The policy with which the mutex should operate.
Reader
Writer

Notice

Mutexes implemented by this class cannot be interrupted using Task.interrupt(). The corresponding InterruptException will be deferred until the next blocking operation yields the event loop.

Use InterruptibleTaskReadWriteMutex as an alternative that can be interrupted.

cf. core.sync.mutex.ReadWriteMutex

Authors

Leonid Kramer, Sönke Ludwig, Manuel Frischknecht

Copyright

© 2012-2019 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.