Some of the locks can produce condition variables via the predicate
cond_new/2. As a convenience a pair of a lock and condition variable
can be created by the predicate monitor_new/2. The resulting object
is suitable both for the lock predicates from the module "lock" and
for the condition variable predicates from this module.
A condition variable allows a thread to temporarily leave a critical
region via the predicates cond_wait/1 and cond_wait_timeout/2. The
predicates cond_notify/1 and cond_notify_all/1 on the other hand let
a waiting thread respectively all waiting threads enter their
critical region again.
The following monitor predicates are provided:
- The predicate succeeds in M with a new monitor. The monitor
implements the Java Lock interface and the Java Condition
interface at the same time.
- cond_new(L, C):
- The predicate succeeds in C with a new condition for the lock
- The predicate succeeds when the condition C was notified.
- cond_wait_timeout(C, T):
- The predicate succeeds when the condition C was notified in
the time-out T. Otherwise the predicate fails.
- The predicate succeeds in notifying one thread waiting on C.
- The predicate succeeds in notifying all threads waiting on C.
The following monitor evaluable functions are provided:
- Returns the current time in milliseconds.