ACE_TPQ_Entry Class Reference

Token Proxy Queue entry. Used in the ACE_Token_Proxy_Queue. More...

#include <Local_Tokens.h>

Inheritance diagram for ACE_TPQ_Entry:

Inheritance graph
[legend]
Collaboration diagram for ACE_TPQ_Entry:

Collaboration graph
[legend]
List of all members.

Public Types

typedef void(* PTVF )(void *)

Public Member Functions

 ACE_TPQ_Entry (void)
 Null constructor.

 ACE_TPQ_Entry (const ACE_Token_Proxy *proxy, const ACE_TCHAR *client_id)
 Constructor.

 ACE_TPQ_Entry (const ACE_TPQ_Entry &rhs)
 Copy constructor.

 ~ACE_TPQ_Entry (void)
 Destructor.

void operator= (const ACE_TPQ_Entry &rhs)
 Copy operator use by the queue.

ACE_Token_Proxyproxy (void) const
 Get top of the queue.

void proxy (ACE_Token_Proxy *)
 Set top of the queue.

int nesting_level (void) const
 Get nesting level of the entry.

void nesting_level (int delta)
 Delta nesting level of the entry.

const ACE_TCHARclient_id (void) const
 Get client_id of the entry.

void client_id (const ACE_TCHAR *)
 Set client_id of the entry.

int equal_client_id (const ACE_TCHAR *id)
 Returns 1 if id == client id. Does not check for id == 0.

void set (void(*sleep_hook)(void *))
 One method for arg and sleep_hook.

void sleep_hook (void(*sh)(void *))
 Set sleep hook of the entry.

PTVF sleep_hook (void) const
 Get sleep hook of the entry.

void call_sleep_hook (void)
 Call the sleep hook function or method passing arg.

void dump (void) const
 Dump the state of the class.

int waiting (void) const
 Get whether this client is blocked waiting for a token.

void waiting (int w)
 Set whether this client is blocked waiting for a token.


Public Attributes

ACE_TOKEN_CONST::COND_VAR cond_var_
ACE_TOKEN_CONST::MUTEX lock_
ACE_TPQ_Entrynext_
 Pointer to next in list.


Private Attributes

int waiting_
 This client is waiting for a token.

ACE_Token_Proxyproxy_
 Proxy.

int nesting_level_
 Nesting level.

void * arg_
 Arg.

ACE_TCHAR client_id_ [ACE_MAXCLIENTIDLEN]
 Client id.

void(* sleep_hook_ )(void *)
 Sleep hook.


Friends

class ACE_Token_Manager

Detailed Description

Token Proxy Queue entry. Used in the ACE_Token_Proxy_Queue.

Not a public interface.

Definition at line 107 of file Local_Tokens.h.


Member Typedef Documentation

typedef void(* ACE_TPQ_Entry::PTVF)(void *)
 

Definition at line 111 of file Local_Tokens.h.


Constructor & Destructor Documentation

ACE_TPQ_Entry::ACE_TPQ_Entry void   ) 
 

Null constructor.

Definition at line 138 of file Local_Tokens.cpp.

References ACE_TRACE.

00139   : cond_var_ (lock_),
00140     proxy_ (0),
00141     nesting_level_ (0),
00142     sleep_hook_ (0)
00143 {
00144   ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry null const.");
00145 }

ACE_TPQ_Entry::ACE_TPQ_Entry const ACE_Token_Proxy proxy,
const ACE_TCHAR client_id
 

Constructor.

Definition at line 104 of file Local_Tokens.cpp.

References ACE_LIB_TEXT, ACE_TCHAR, ACE_thread_t, ACE_TRACE, client_id(), ACE_OS::hostname(), MAXHOSTNAMELEN, ACE_Thread::self(), and ACE_OS::sprintf().

00106   : cond_var_ (lock_),
00107     next_ (0),
00108     // This const typecast is safe.
00109     proxy_ ((ACE_Token_Proxy *) new_proxy),
00110     nesting_level_ (0),
00111     sleep_hook_ (0)
00112 {
00113   ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry");
00114 
00115   if (client_id != 0)
00116     this->client_id (client_id);
00117   else
00118     {
00119       // Just make sure we have enough space.
00120       ACE_TCHAR host_name[MAXHOSTNAMELEN];
00121       ACE_TCHAR name[(sizeof host_name / sizeof (ACE_TCHAR)) + 256];
00122       ACE_OS::hostname (host_name, sizeof host_name);
00123 
00124       ACE_thread_t thread_id = ACE_Thread::self ();
00125 
00126       // The cast is an attempt to get this to compile (and run,
00127       // hopefully) regardless of the type of ACE_thread_t.
00128       ACE_OS::sprintf (name,
00129                        ACE_LIB_TEXT ("/%s/%u/%lu"),
00130                        host_name,
00131                        static_cast<u_int> (ACE_OS::getpid ()),
00132                        *reinterpret_cast<u_long *> (&thread_id));
00133 
00134       this->client_id (name);
00135     }
00136 }

ACE_TPQ_Entry::ACE_TPQ_Entry const ACE_TPQ_Entry rhs  ) 
 

Copy constructor.

Definition at line 147 of file Local_Tokens.cpp.

References ACE_TRACE.

00148 : cond_var_ (lock_)
00149 {
00150   ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry copy const.");
00151   *this = rhs;
00152 }

ACE_TPQ_Entry::~ACE_TPQ_Entry void   ) 
 

Destructor.

Definition at line 154 of file Local_Tokens.cpp.

References ACE_TRACE.

00155 {
00156   ACE_TRACE ("ACE_TPQ_Entry::~ACE_TPQ_Entry");
00157 }


Member Function Documentation

void ACE_TPQ_Entry::call_sleep_hook void   ) 
 

Call the sleep hook function or method passing arg.

Referenced by ACE_RW_Token::acquire(), and ACE_Mutex_Token::acquire().

void ACE_TPQ_Entry::client_id const ACE_TCHAR  ) 
 

Set client_id of the entry.

Definition at line 172 of file Local_Tokens.cpp.

References ACE_MAXCLIENTIDLEN, ACE_TCHAR, ACE_TRACE, and ACE_OS::strsncpy().

00173 {
00174   ACE_TRACE ("ACE_TPQ_Entry::client_id");
00175 
00176   if (id == 0)
00177     return;
00178 
00179   ACE_OS::strsncpy (this->client_id_,
00180                     (ACE_TCHAR *) id,
00181                     ACE_MAXCLIENTIDLEN);
00182 }

const ACE_TCHAR* ACE_TPQ_Entry::client_id void   )  const
 

Get client_id of the entry.

Referenced by ACE_TPQ_Entry(), ACE_RW_Token::acquire(), ACE_Mutex_Token::acquire(), ACE_Token_Manager::check_deadlock(), ACE_Token_Proxy::client_id(), ACE_TSS_TPQ_Entry::operator ACE_TPQ_Entry *(), operator=(), ACE_RW_Token::owners(), ACE_RW_Token::release(), ACE_Mutex_Token::release(), ACE_RW_Token::renew(), ACE_Mutex_Token::renew(), ACE_RW_Token::tryacquire(), and ACE_Mutex_Token::tryacquire().

void ACE_TPQ_Entry::dump void   )  const
 

Dump the state of the class.

Reimplemented in ACE_TSS_TPQ_Entry.

Definition at line 81 of file Local_Tokens.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, client_id_, LM_DEBUG, and nesting_level_.

Referenced by ACE_Token_Proxy_Queue::dump(), and ACE_TSS_TPQ_Entry::dump().

00082 {
00083 #if defined (ACE_HAS_DUMP)
00084   ACE_TRACE ("ACE_TPQ_Entry::dump");
00085   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00086   ACE_DEBUG ((LM_DEBUG,
00087               ACE_LIB_TEXT ("ACE_TPQ_Entry::dump:\n")
00088               ACE_LIB_TEXT (" nesting_level_ = %d\n")
00089               ACE_LIB_TEXT (" client_id_ = %s\n"),
00090               nesting_level_,
00091               client_id_));
00092 
00093   if (next_ != 0)
00094     {
00095       ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("next:.\n")));
00096       next_->dump ();
00097     }
00098 
00099   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_TPQ_Entry::dump end.\n")));
00100   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00101 #endif /* ACE_HAS_DUMP */
00102 }

int ACE_TPQ_Entry::equal_client_id const ACE_TCHAR id  ) 
 

Returns 1 if id == client id. Does not check for id == 0.

Referenced by ACE_RW_Token::is_owner(), ACE_Mutex_Token::is_owner(), ACE_RW_Token::is_waiting_for(), ACE_Mutex_Token::is_waiting_for(), and ACE_Mutex_Token::owners().

void ACE_TPQ_Entry::nesting_level int  delta  ) 
 

Delta nesting level of the entry.

int ACE_TPQ_Entry::nesting_level void   )  const
 

Get nesting level of the entry.

Referenced by ACE_RW_Token::acquire(), ACE_Mutex_Token::acquire(), operator=(), ACE_RW_Token::release(), ACE_Mutex_Token::release(), ACE_RW_Token::tryacquire(), and ACE_Mutex_Token::tryacquire().

void ACE_TPQ_Entry::operator= const ACE_TPQ_Entry rhs  ) 
 

Copy operator use by the queue.

Definition at line 160 of file Local_Tokens.cpp.

References ACE_TRACE, client_id(), nesting_level(), nesting_level_, proxy(), sleep_hook(), and sleep_hook_.

00161 {
00162   ACE_TRACE ("ACE_TPQ_Entry::operator=");
00163   if (&rhs == this)
00164     return;
00165   this->proxy_ = rhs.proxy ();
00166   this->nesting_level_ = rhs.nesting_level ();
00167   this->client_id (rhs.client_id ());
00168   this->sleep_hook_ = rhs.sleep_hook ();
00169 }

void ACE_TPQ_Entry::proxy ACE_Token_Proxy  ) 
 

Set top of the queue.

ACE_Token_Proxy* ACE_TPQ_Entry::proxy void   )  const
 

Get top of the queue.

Referenced by ACE_RW_Token::acquire(), ACE_Mutex_Token::acquire(), ACE_RW_Token::is_owner(), ACE_RW_Token::notify_new_owner(), ACE_TSS_TPQ_Entry::operator ACE_TPQ_Entry *(), operator=(), ACE_RW_Token::owners(), ACE_RW_Token::release(), ACE_Mutex_Token::release(), ACE_RW_Token::renew(), ACE_Mutex_Token::renew(), and ACE_RW_Token::tryacquire().

void ACE_TPQ_Entry::set void(*  sleep_hook)(void *)  ) 
 

One method for arg and sleep_hook.

PTVF ACE_TPQ_Entry::sleep_hook void   )  const
 

Get sleep hook of the entry.

void ACE_TPQ_Entry::sleep_hook void(*  sh)(void *)  ) 
 

Set sleep hook of the entry.

Referenced by ACE_Token_Proxy::acquire(), operator=(), and ACE_Token_Proxy::tryacquire().

void ACE_TPQ_Entry::waiting int  w  ) 
 

Set whether this client is blocked waiting for a token.

int ACE_TPQ_Entry::waiting void   )  const
 

Get whether this client is blocked waiting for a token.


Friends And Related Function Documentation

friend class ACE_Token_Manager [friend]
 

Definition at line 109 of file Local_Tokens.h.


Member Data Documentation

void* ACE_TPQ_Entry::arg_ [private]
 

Arg.

Definition at line 189 of file Local_Tokens.h.

ACE_TCHAR ACE_TPQ_Entry::client_id_[ACE_MAXCLIENTIDLEN] [private]
 

Client id.

Reimplemented in ACE_TSS_TPQ_Entry.

Definition at line 192 of file Local_Tokens.h.

Referenced by dump().

ACE_TOKEN_CONST::COND_VAR ACE_TPQ_Entry::cond_var_
 

Definition at line 166 of file Local_Tokens.h.

Referenced by ACE_Token_Proxy::acquire(), ACE_Token_Proxy::renew(), and ACE_Token_Proxy::token_acquired().

ACE_TOKEN_CONST::MUTEX ACE_TPQ_Entry::lock_
 

Definition at line 167 of file Local_Tokens.h.

int ACE_TPQ_Entry::nesting_level_ [private]
 

Nesting level.

Definition at line 186 of file Local_Tokens.h.

Referenced by dump(), and operator=().

ACE_TPQ_Entry* ACE_TPQ_Entry::next_
 

Pointer to next in list.

Definition at line 170 of file Local_Tokens.h.

Referenced by ACE_RW_Token::acquire(), ACE_TPQ_Iterator::advance(), ACE_Token_Proxy_Queue::dequeue(), ACE_Token_Proxy_Queue::enqueue(), and ACE_Token_Proxy_Queue::remove().

ACE_Token_Proxy* ACE_TPQ_Entry::proxy_ [private]
 

Proxy.

Reimplemented in ACE_TSS_TPQ_Entry.

Definition at line 183 of file Local_Tokens.h.

void(* ACE_TPQ_Entry::sleep_hook_)(void *) [private]
 

Sleep hook.

Referenced by operator=().

int ACE_TPQ_Entry::waiting_ [private]
 

This client is waiting for a token.

Definition at line 180 of file Local_Tokens.h.


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