ACE_Token::ACE_Token_Queue_Entry Struct Reference

#include <Token.h>

Collaboration diagram for ACE_Token::ACE_Token_Queue_Entry:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, ACE_thread_t t_id)
 Constructor.

 ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, ACE_thread_t t_id, ACE_Condition_Attributes &attributes)
 Constructor using a pre-allocated attributes.

int wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock)
 Entry blocks on the token.

int signal (void)
 Notify (unblock) the entry.


Public Attributes

ACE_Token_Queue_Entrynext_
 Pointer to next waiter.

ACE_thread_t thread_id_
 ACE_Thread id of this waiter.

ACE_Semaphore cv_
 ACE_Semaphore object used to wake up waiter when it can run again.

int runable_
 Ok to run.


Detailed Description

The following structure implements a LIFO/FIFO queue of waiter threads that are asleep waiting to obtain the token.

Definition at line 221 of file Token.h.


Constructor & Destructor Documentation

ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry ACE_Thread_Mutex m,
ACE_thread_t  t_id
 

Constructor.

Definition at line 44 of file Token.cpp.

References ACE_TOKEN_USES_SEMAPHORE, and ACE_TRACE.

00046   : next_ (0),
00047     thread_id_ (t_id),
00048 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00049     cv_ (0),
00050 #else
00051     cv_ (m),
00052 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00053     runable_ (0)
00054 {
00055 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00056   ACE_UNUSED_ARG (m);
00057 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00058 
00059   ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry");
00060 }

ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry ACE_Thread_Mutex m,
ACE_thread_t  t_id,
ACE_Condition_Attributes attributes
 

Constructor using a pre-allocated attributes.

Definition at line 62 of file Token.cpp.

References ACE_TOKEN_USES_SEMAPHORE, and ACE_TRACE.

00065   : next_ (0),
00066     thread_id_ (t_id),
00067 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00068     cv_ (0),
00069 #else
00070     cv_ (m, attributes),
00071 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00072     runable_ (0)
00073 {
00074 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00075   ACE_UNUSED_ARG (m);
00076   ACE_UNUSED_ARG (attributes);
00077 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00078 
00079   ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry");
00080 }


Member Function Documentation

ACE_INLINE int ACE_Token::ACE_Token_Queue_Entry::signal void   ) 
 

Notify (unblock) the entry.

Definition at line 135 of file Token.inl.

References cv_, and ACE_Semaphore::release().

Referenced by ACE_Token::wakeup_next_waiter().

00136 {
00137   return
00138 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00139     this->cv_.release ();
00140 #else
00141     this->cv_.signal ();
00142 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00143 }

ACE_INLINE int ACE_Token::ACE_Token_Queue_Entry::wait ACE_Time_Value timeout,
ACE_Thread_Mutex lock
 

Entry blocks on the token.

Definition at line 119 of file Token.inl.

References ACE_Thread_Mutex::acquire(), ACE_Semaphore::acquire(), cv_, and ACE_Thread_Mutex::release().

Referenced by ACE_Token::renew(), and ACE_Token::shared_acquire().

00120 {
00121 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00122   lock.release ();
00123   int const retv = (timeout == 0 ?
00124                     this->cv_.acquire () :
00125                     this->cv_.acquire (*timeout));
00126   lock.acquire ();
00127   return retv;
00128 #else
00129   ACE_UNUSED_ARG (lock);
00130   return this->cv_.wait (timeout);
00131 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00132 }


Member Data Documentation

ACE_Semaphore ACE_Token::ACE_Token_Queue_Entry::cv_
 

ACE_Semaphore object used to wake up waiter when it can run again.

Definition at line 246 of file Token.h.

Referenced by signal(), and wait().

ACE_Token_Queue_Entry* ACE_Token::ACE_Token_Queue_Entry::next_
 

Pointer to next waiter.

Definition at line 239 of file Token.h.

Referenced by ACE_Token::ACE_Token_Queue::insert_entry(), and ACE_Token::ACE_Token_Queue::remove_entry().

int ACE_Token::ACE_Token_Queue_Entry::runable_
 

Ok to run.

Definition at line 253 of file Token.h.

Referenced by ACE_Token::renew(), ACE_Token::shared_acquire(), and ACE_Token::wakeup_next_waiter().

ACE_thread_t ACE_Token::ACE_Token_Queue_Entry::thread_id_
 

ACE_Thread id of this waiter.

Definition at line 242 of file Token.h.

Referenced by ACE_Token::renew(), and ACE_Token::wakeup_next_waiter().


The documentation for this struct was generated from the following files:
Generated on Thu Nov 9 11:31:41 2006 for ACE by doxygen 1.3.6