Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Thread::Condition Class Reference

Provides an inter-thread signaling and synchronization mechanism. More...

#include <Thread.h>


Detailed Description

Provides an inter-thread signaling and synchronization mechanism.

When waiting (either wait() or timedwait()), the lock argument must initially be passed in locked state. During the wait, the lock is released, and then reaquired before returning, regardless of return status (i.e. timeout). This seems to be enforced at a priority that precludes thread cancellation (tested on Linux and Mac OS X), so although a Thread::stop() call will cancel the conditional wait, it won't cancel the subsequent lock acquisition (even with additional Thread::stop() calls!)

On USE_SIGNAL_TO_CANCEL_THREAD platforms (i.e. Mac OS X), wait() and timedwait() imply a call to Thread::testCurrentCancel in order to handle cancellation, so you can assume if they return 'naturally' that the condition was detected, not cancellation.

Definition at line 83 of file Thread.h.

List of all members.

Public Member Functions

 Condition ()
 constructor
 ~Condition ()
 destructor
void broadcast () const
 wake up all threads waiting on the condition
void signal () const
 wake up a single thread waiting on the condition (which thread is unspecified)
bool timedwait (Lock &l, const timespec *abstime, bool noWarn=false) const
 wait for at most abstime for the condition before giving up (return true if condition found), l must be locked, will be released and re-aquired (regardless of signal vs. timeout, see class overview docs)
void wait (Lock &l, bool noWarn=false) const
 wait for condition, l must be locked, will be released and re-aquired (see class overview docs)

Static Protected Member Functions

static void displayRecursiveLockWarning (const char *fn, unsigned int locklevel)

Protected Attributes

ConditionStorage * mycond
 internal class to hold system-dependent information

Private Member Functions

 Condition (const Condition &l)
 don't call
Conditionoperator= (const Condition &l)
 don't call

Constructor & Destructor Documentation

Thread::Condition::Condition (  ) 

constructor

Definition at line 688 of file Thread.cc.

Thread::Condition::~Condition (  ) 

destructor

Definition at line 689 of file Thread.cc.

Thread::Condition::Condition ( const Condition l  )  [private]

don't call


Member Function Documentation

void Thread::Condition::broadcast (  )  const

wake up all threads waiting on the condition

Definition at line 691 of file Thread.cc.

Referenced by ThreadedMessageQueue< EventBase * >::send().

void Thread::Condition::displayRecursiveLockWarning ( const char *  fn,
unsigned int  locklevel 
) [static, protected]

Definition at line 755 of file Thread.cc.

Referenced by timedwait(), and wait().

Condition& Thread::Condition::operator= ( const Condition l  )  [private]

don't call

void Thread::Condition::signal (  )  const

wake up a single thread waiting on the condition (which thread is unspecified)

Definition at line 696 of file Thread.cc.

bool Thread::Condition::timedwait ( Lock l,
const timespec *  abstime,
bool  noWarn = false 
) const

wait for at most abstime for the condition before giving up (return true if condition found), l must be locked, will be released and re-aquired (regardless of signal vs. timeout, see class overview docs)

Definition at line 701 of file Thread.cc.

void Thread::Condition::wait ( Lock l,
bool  noWarn = false 
) const

wait for condition, l must be locked, will be released and re-aquired (see class overview docs)

Definition at line 730 of file Thread.cc.

Referenced by ThreadedMessageQueue< EventBase * >::front().


Member Data Documentation

ConditionStorage* Thread::Condition::mycond [protected]

internal class to hold system-dependent information

the condition's implementation storage

Definition at line 94 of file Thread.h.

Referenced by broadcast(), signal(), timedwait(), wait(), and ~Condition().


The documentation for this class was generated from the following files:

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:17 2016 by Doxygen 1.6.3