Get number of the labels locks has been acquired on.
Notify all consumers on filtered labels by forcibly rejecting promises consumers are waiting on. This will basically flush locks from all filtered labels.
Filter labels on which forced notify needs to be applied.
Notify consumers about computation completion.
Although either producer or consumers can call this function,
it is recommended that producer who successfully acquired lock
to notify consumers.
Label to notify on.
Result of the computation or it's error.
Waits on label
.
When lock is acquired already, Promise of the locked mutex is returned.
This allows consumers to wait on provided promise, until
producer who firstly acquired lock, finishes computation.
Depending on the locked operation type, the following combinations are allowed:
Acquired | Requested | Explanation |
---|---|---|
LockedOperationType.WRITE | NONE | When operation was locked for write, i.e. some resource is modified, you can't overwrite it or read intermediary results until operation finishes. |
LockedOperationType.READ | LockedOperationType.READ | When operation was locked for read, you can only perform another reads and not allowed to write until all reads have been completed. |
After operation has been completed, AwaiterRole.PRODUCER should call LabeledConditionalVariableManager.notifyAll to notify consumers about operation completion.
Label to wait on.
Waiting status.
Format AwaiterRole enum into it's corresponding string representation.
Awaiter role.
String representation.
Format LockedOperationType bitwise enum into it's corresponding string representation.
Locked operation type.
String representation.
Class which manages a set of conditional variables. Each conditional variable has an associated label, aka identifier.
These conditional variables are used to synchronize access to operation. Namely to ensure that operation will be performed only once by the AwaiterRole.PRODUCER, and then, in case operation is still performing, other AwaiterRole.CONSUMER can await operation promise, until AwaiterRole.PRODUCER fulfills it.