Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Token::ACE_Token_Queue_Entry Struct Reference

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

#include <Token.h>

Collaboration diagram for ACE_Token::ACE_Token_Queue_Entry:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, ACE_thread_t t_id)
 Constructor. More...

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

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

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


Public Attributes

ACE_Token_Queue_Entry * next_
 Pointer to next waiter. More...

ACE_thread_t thread_id_
 ACE_Thread id of this waiter. More...

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

int runable_
 Ok to run. More...


Detailed Description

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

Definition at line 202 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 41 of file Token.cpp.

References ACE_thread_t, ACE_TOKEN_USES_SEMAPHORE, and ACE_TRACE.

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

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 59 of file Token.cpp.

References ACE_thread_t, ACE_TOKEN_USES_SEMAPHORE, and ACE_TRACE.

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


Member Function Documentation

ACE_INLINE int ACE_Token::ACE_Token_Queue_Entry::signal void   
 

Notify (unblock) the entry.

Definition at line 127 of file Token.i.

References cv_, and ACE_Semaphore::release.

00128 {
00129   return 
00130 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00131     this->cv_.release ();
00132 #else
00133     this->cv_.signal ();
00134 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00135 }

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 111 of file Token.i.

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

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

00112 {
00113 #if defined (ACE_TOKEN_USES_SEMAPHORE)
00114   lock.release ();
00115   int retv = (timeout == 0 ?
00116               this->cv_.acquire () :
00117               this->cv_.acquire (*timeout));
00118   lock.acquire ();
00119   return retv;
00120 #else
00121   ACE_UNUSED_ARG (lock);
00122   return this->cv_.wait (timeout);
00123 #endif /* ACE_TOKEN_USES_SEMAPHORE */
00124 }


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 227 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 220 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 234 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 223 of file Token.h.

Referenced by ACE_Token::renew.


The documentation for this struct was generated from the following files:
Generated on Mon Jun 16 12:58:22 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002