ucommon::ConditionalAccess Class Reference

The conditional rw seperates scheduling for optizming behavior or rw locks. More...

#include <thread.h>

Inheritance diagram for ucommon::ConditionalAccess:

Inheritance graph
[legend]
Collaboration diagram for ucommon::ConditionalAccess:

Collaboration graph
[legend]

Public Member Functions

void access (void)
 Access mode shared thread scheduling.
void commit (void)
 Complete exclusive mode write scheduling.
 ConditionalAccess ()
 Initialize and construct conditional.
void limit_sharing (unsigned max)
 Specify a maximum sharing (access) limit.
void modify (void)
 Exclusive mode write thread scheduling.
void release (void)
 Release access mode read scheduling.
 ~ConditionalAccess ()
 Destroy conditional, release any blocked threads.

Protected Member Functions

void broadcast (void)
 Signal the conditional to release all broadcast threads.
void lock (void)
 Lock the conditional's supporting mutex.
void signal (void)
 Signal the conditional to release one signalled thread.
void unlock (void)
 Unlock the conditional's supporting mutex.
void waitBroadcast (void)
 Wait (block) until broadcast.
bool waitBroadcast (struct timespec *timeout)
 Conditional wait for broadcast on timespec timeout.
bool waitBroadcast (timeout_t timeout)
 Conditional wait for broadcast on millisecond timeout.
void waitSignal (void)
 Wait (block) until signalled.
bool waitSignal (struct timespec *timeout)
 Conditional wait for signal on timespec timeout.
bool waitSignal (timeout_t timeout)
 Conditional wait for signal on millisecond timeout.

Static Protected Member Functions

static void set (struct timespec *hires, timeout_t timeout)
 Convert a millisecond timeout into use for high resolution conditional timers.

Protected Attributes

pthread_cond_t bcast
unsigned pending
unsigned sharing
unsigned waiting

Detailed Description

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.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 213 of file thread.h.


Member Function Documentation

void ucommon::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.

Parameters:
max sharing level.

static void ucommon::ConditionalAccess::set ( struct timespec *  hires,
timeout_t  timeout 
) [inline, static, protected]

Convert a millisecond timeout into use for high resolution conditional timers.

Parameters:
hires timespec representation to set.
timeout to convert.

Reimplemented from ucommon::Conditional.

Definition at line 259 of file thread.h.

bool ucommon::ConditionalAccess::waitBroadcast ( struct timespec *  timeout  )  [protected]

Conditional wait for broadcast on timespec timeout.

Parameters:
timeout as a high resolution timespec.
Returns:
true if signalled, false if timer expired.

bool ucommon::ConditionalAccess::waitBroadcast ( timeout_t  timeout  )  [protected]

Conditional wait for broadcast on millisecond timeout.

Parameters:
timeout in milliseconds.
Returns:
true if signalled, false if timer expired.

bool ucommon::ConditionalAccess::waitSignal ( struct timespec *  timeout  )  [protected]

Conditional wait for signal on timespec timeout.

Parameters:
timeout as a high resolution timespec.
Returns:
true if signalled, false if timer expired.

bool ucommon::ConditionalAccess::waitSignal ( timeout_t  timeout  )  [protected]

Conditional wait for signal on millisecond timeout.

Parameters:
timeout in milliseconds.
Returns:
true if signalled, false if timer expired.


The documentation for this class was generated from the following file:
Generated on 14 Aug 2013 for UCommon by  doxygen 1.4.7