#include <Synch.h>
Collaboration diagram for ACE_Condition_Thread_Mutex:

Public Methods | |
| ACE_Condition_Thread_Mutex (const ACE_Thread_Mutex &m, const ACE_TCHAR *name=0, void *arg=0) | |
| Initialize the condition variable. More... | |
| ACE_Condition_Thread_Mutex (const ACE_Thread_Mutex &m, ACE_Condition_Attributes &attributes, const ACE_TCHAR *name=0, void *arg=0) | |
| Initialize the condition variable. More... | |
| ~ACE_Condition_Thread_Mutex (void) | |
| Implicitly destroy the condition variable. More... | |
| int | remove (void) |
| int | wait (const ACE_Time_Value *abstime) |
| int | wait (void) |
| Block on condition. More... | |
| int | wait (ACE_Thread_Mutex &mutex, const ACE_Time_Value *abstime=0) |
| int | signal (void) |
| Signal one waiting thread. More... | |
| int | broadcast (void) |
| Signal *all* waiting threads. More... | |
| ACE_Thread_Mutex & | mutex (void) |
| Returns a reference to the underlying mutex;. More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Protected Attributes | |
| ACE_cond_t | cond_ |
| Condition variable. More... | |
| ACE_Thread_Mutex & | mutex_ |
| Reference to mutex lock. More... | |
| int | removed_ |
| Keeps track of whether <remove> has been called yet to avoid multiple <remove> calls, e.g., explicitly and implicitly in the destructor. This flag isn't protected by a lock, so make sure that you don't have multiple threads simultaneously calling <remove> on the same object, which is a bad idea anyway... More... | |
Private Methods | |
| void | operator= (const ACE_Condition_Thread_Mutex &) |
| ACE_Condition_Thread_Mutex (const ACE_Condition_Thread_Mutex &) | |
This should be an instantiation of ACE_Condition but problems with compilers precludes this...
Definition at line 1250 of file Synch.h.
|
||||||||||||||||
|
Initialize the condition variable.
Definition at line 588 of file Synch.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TCHAR, ACE_OS::cond_init, and LM_ERROR.
00591 : mutex_ ((ACE_Thread_Mutex &) m), 00592 removed_ (0) 00593 { 00594 #if defined (ACE_HAS_FSU_PTHREADS) 00595 // Initialize FSU pthreads package. 00596 // If called more than once, pthread_init does nothing 00597 // and so does no harm. 00598 pthread_init (); 00599 #endif /* ACE_HAS_FSU_PTHREADS */ 00600 00601 // ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); 00602 if (ACE_OS::cond_init (&this->cond_, 00603 (short) USYNC_THREAD, 00604 name, 00605 arg) != 0) 00606 ACE_ERROR ((LM_ERROR, 00607 ACE_LIB_TEXT ("%p\n"), 00608 ACE_LIB_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); 00609 } |
|
||||||||||||||||||||
|
Initialize the condition variable.
Definition at line 612 of file Synch.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TCHAR, ACE_Condition_Attributes::attributes_, ACE_OS::cond_init, and LM_ERROR.
00616 : mutex_ ((ACE_Thread_Mutex &) m), 00617 removed_ (0) 00618 { 00619 #if defined (ACE_HAS_FSU_PTHREADS) 00620 // Initialize FSU pthreads package. 00621 // If called more than once, pthread_init does nothing 00622 // and so does no harm. 00623 pthread_init (); 00624 #endif /* ACE_HAS_FSU_PTHREADS */ 00625 00626 // ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); 00627 if (ACE_OS::cond_init (&this->cond_, attributes.attributes_, 00628 name, arg) != 0) 00629 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), 00630 ACE_LIB_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); 00631 } |
|
|
Implicitly destroy the condition variable.
Definition at line 633 of file Synch.cpp. References remove.
00634 {
00635 // ACE_TRACE ("ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex");
00636 this->remove ();
00637 }
|
|
|
|
|
|
Signal *all* waiting threads.
Definition at line 675 of file Synch.cpp. References ACE_OS::cond_broadcast. Referenced by ACE_Thread_Manager::remove_thr, ACE_Future_Rep::set, and ACE_Barrier::wait.
00676 {
00677 // ACE_TRACE ("ACE_Condition_Thread_Mutex::broadcast");
00678 return ACE_OS::cond_broadcast (&this->cond_);
00679 }
|
|
|
Dump the state of an object.
Definition at line 574 of file Synch.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, and LM_DEBUG. Referenced by ACE_Sub_Barrier::dump, and ACE_Future_Rep::dump.
00575 {
00576 // ACE_TRACE ("ACE_Condition_Thread_Mutex::dump");
00577
00578 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00579 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
00580 #if defined (ACE_WIN32)
00581 ACE_DEBUG ((LM_DEBUG,
00582 ACE_LIB_TEXT ("waiters = %d\n"),
00583 this->cond_.waiters ()));
00584 #endif /* ACE_WIN32 */
00585 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00586 }
|
|
|
Returns a reference to the underlying mutex;.
|
|
|
|
|
|
Explicitly destroy the condition variable. Note that only one thread should call this method since it doesn't protect against race conditions. Referenced by ~ACE_Condition_Thread_Mutex. |
|
|
Signal one waiting thread.
Definition at line 668 of file Synch.cpp. References ACE_OS::cond_signal.
00669 {
00670 // ACE_TRACE ("ACE_Condition_Thread_Mutex::signal");
00671 return ACE_OS::cond_signal (&this->cond_);
00672 }
|
|
||||||||||||
|
Block on condition or until absolute time-of-day has passed. If abstime == 0 use "blocking" wait() semantics on the <mutex> passed as a parameter (this is useful if you need to store the <Condition> in shared memory). Else, if <abstime> != 0 and the call times out before the condition is signaled <wait> returns -1 and sets errno to ETIME. Definition at line 651 of file Synch.cpp. References ACE_OS::cond_timedwait, and ACE_Thread_Mutex::lock_.
00653 {
00654 // ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
00655 return ACE_OS::cond_timedwait (&this->cond_,
00656 &mutex.lock_,
00657 (ACE_Time_Value *) abstime);
00658 }
|
|
|
Block on condition.
Definition at line 644 of file Synch.cpp. References ACE_OS::cond_wait. Referenced by wait.
00645 {
00646 // ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
00647 return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock_);
00648 }
|
|
|
Block on condition, or until absolute time-of-day has passed. If abstime == 0 use "blocking" <wait> semantics. Else, if <abstime> != 0 and the call times out before the condition is signaled <wait> returns -1 and sets errno to ETIME. Definition at line 661 of file Synch.cpp. References wait. Referenced by ACE_Future_Rep::operator T, ACE_Thread_Manager::wait, and ACE_Barrier::wait.
00662 {
00663 // ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
00664 return this->wait (this->mutex_, abstime);
00665 }
|
|
|
Declare the dynamic allocation hooks.
|
|
|
Condition variable.
|
|
|
Reference to mutex lock.
|
|
|
Keeps track of whether <remove> has been called yet to avoid multiple <remove> calls, e.g., explicitly and implicitly in the destructor. This flag isn't protected by a lock, so make sure that you don't have multiple threads simultaneously calling <remove> on the same object, which is a bad idea anyway...
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002