Did you know ... | Search Documentation: |
rwlocks.pl -- Read/write locks |
This library implements read/write locks on top of with_mutex/2. Read/write locks are synchronization objects that allow for multiple readers or a single writer to be active.
read
, write
, read(Priority)
or write(Priority)
. The default
read
priority is 100 and the default write
priority is 200.
These values prioritize writers over readers. Goal may start if
If Goal may not start immediately the thread waits using
thread_wait/2. The Options timeout
and deadline
are passed to
thread_wait/2. If the time limit is exceeded an exception is raised.
Read/write locks are widely critized for their poor behaviour on several workloads. They perform well in scenarios where read operations take long, and write operations are relatively fast and occur only occasionally. Transactions, as implemented by transaction/1,2 are often a better alternative.
This predicate uses a normal mutex and a flag with the same name. See with_mutex/2 and flag/3. Neither the mutex nor the flag should be used directly.
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
read
, write
, read(Priority)
or write(Priority)
. The default
read
priority is 100 and the default write
priority is 200.
These values prioritize writers over readers. Goal may start if
If Goal may not start immediately the thread waits using
thread_wait/2. The Options timeout
and deadline
are passed to
thread_wait/2. If the time limit is exceeded an exception is raised.
Read/write locks are widely critized for their poor behaviour on several workloads. They perform well in scenarios where read operations take long, and write operations are relatively fast and occur only occasionally. Transactions, as implemented by transaction/1,2 are often a better alternative.
This predicate uses a normal mutex and a flag with the same name. See with_mutex/2 and flag/3. Neither the mutex nor the flag should be used directly.