The conditional rw seperates scheduling for optizming behavior or rw locks. More...
#include <thread.h>
Public Member Functions | |
ConditionalAccess () | |
Initialize and construct conditional. | |
~ConditionalAccess () | |
Destroy conditional, release any blocked threads. | |
void | access (void) |
Access mode shared thread scheduling. | |
void | modify (void) |
Exclusive mode write thread scheduling. | |
void | release (void) |
Release access mode read scheduling. | |
void | commit (void) |
Complete exclusive mode write scheduling. | |
void | limit_sharing (unsigned max) |
Specify a maximum sharing (access) limit. | |
Protected Member Functions | |
bool | waitSignal (timeout_t timeout) |
Conditional wait for signal on millisecond timeout. | |
bool | waitBroadcast (timeout_t timeout) |
Conditional wait for broadcast on millisecond timeout. | |
bool | waitSignal (struct timespec *timeout) |
Conditional wait for signal on timespec timeout. | |
bool | waitBroadcast (struct timespec *timeout) |
Conditional wait for broadcast on timespec timeout. | |
void | lock (void) |
Lock the conditional's supporting mutex. | |
void | unlock (void) |
Unlock the conditional's supporting mutex. | |
void | waitSignal (void) |
Wait (block) until signalled. | |
void | waitBroadcast (void) |
Wait (block) until broadcast. | |
void | signal (void) |
Signal the conditional to release one signalled thread. | |
void | broadcast (void) |
Signal the conditional to release all broadcast threads. | |
Static Protected Member Functions | |
static void | gettimeout (timeout_t timeout, struct timespec *hires) |
Convert a millisecond timeout into use for high resolution conditional timers. | |
Protected Attributes | |
unsigned | pending |
unsigned | waiting |
unsigned | sharing |
The conditional rw seperates scheduling for optizming behavior or rw locks.
This varient of conditonal seperates scheduling read (broadcast wakeup) and write (signal wakeup) based threads. This is used to form generic rwlock's as well as the specialized condlock.
Definition at line 194 of file thread.h.
static void ucc::ConditionalAccess::gettimeout | ( | timeout_t | timeout, | |
struct timespec * | hires | |||
) | [inline, static, protected] |
Convert a millisecond timeout into use for high resolution conditional timers.
timeout | to convert. | |
hires | timespec representation to fill. |
Reimplemented from ucc::Conditional.
void ucc::ConditionalAccess::limit_sharing | ( | unsigned | max | ) |
Specify a maximum sharing (access) limit.
This can be used to detect locking errors, such as when aquiring locks that are not released.
max | sharing level. |
bool ucc::ConditionalAccess::waitBroadcast | ( | struct timespec * | timeout | ) | [protected] |
Conditional wait for broadcast on timespec timeout.
timeout | as a high resolution timespec. |
bool ucc::ConditionalAccess::waitBroadcast | ( | timeout_t | timeout | ) | [protected] |
Conditional wait for broadcast on millisecond timeout.
timeout | in milliseconds. |
bool ucc::ConditionalAccess::waitSignal | ( | struct timespec * | timeout | ) | [protected] |
Conditional wait for signal on timespec timeout.
timeout | as a high resolution timespec. |
bool ucc::ConditionalAccess::waitSignal | ( | timeout_t | timeout | ) | [protected] |
Conditional wait for signal on millisecond timeout.
timeout | in milliseconds. |