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

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 Methods

 ACE_TPQ_Entry (void)
 Null constructor. More...

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

 ACE_TPQ_Entry (const ACE_TPQ_Entry &rhs)
 Copy constructor. More...

 ~ACE_TPQ_Entry (void)
 Destructor. More...

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

ACE_Token_Proxyproxy (void) const
 Get top of the queue. More...

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

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

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

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

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

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

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

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

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

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

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

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

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


Public Attributes

ACE_TOKEN_CONST::COND_VAR cond_var_
ACE_TOKEN_CONST::MUTEX lock_
ACE_TPQ_Entry * next_
 Pointer to next in list. More...


Private Attributes

int waiting_
 This client is waiting for a token. More...

ACE_Token_Proxyproxy_
 Proxy. More...

int nesting_level_
 Nesting level. More...

void * arg_
 Arg. More...

ACE_TCHAR client_id_ [ACE_MAXCLIENTIDLEN]
 Client id. More...

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


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 102 of file Local_Tokens.h.


Member Typedef Documentation

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

Definition at line 106 of file Local_Tokens.h.


Constructor & Destructor Documentation

ACE_TPQ_Entry::ACE_TPQ_Entry void   
 

Null constructor.

Definition at line 112 of file Local_Tokens.cpp.

References ACE_TRACE.

00113   : cond_var_ (lock_),
00114     proxy_ (0),
00115     nesting_level_ (0),
00116     sleep_hook_ (0)
00117 {
00118   ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry null const.");
00119 }

ACE_TPQ_Entry::ACE_TPQ_Entry const ACE_Token_Proxy   proxy,
const ACE_TCHAR   client_id
 

Constructor.

Definition at line 78 of file Local_Tokens.cpp.

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

00080   : cond_var_ (lock_),
00081     next_ (0),
00082     // This const typecast is safe.
00083     proxy_ ((ACE_Token_Proxy *) new_proxy),
00084     nesting_level_ (0),
00085     sleep_hook_ (0)
00086 {
00087   ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry");
00088 
00089   if (client_id != 0)
00090     this->client_id (client_id);
00091   else
00092     {
00093       // Just make sure we have enough space.
00094       ACE_TCHAR host_name[MAXHOSTNAMELEN];
00095       ACE_TCHAR name[(sizeof host_name / sizeof (ACE_TCHAR)) + 256];
00096       ACE_OS::hostname (host_name, sizeof host_name);
00097 
00098       ACE_thread_t thread_id = ACE_Thread::self ();
00099 
00100       // The cast is an attempt to get this to compile (and run,
00101       // hopefully) regardless of the type of ACE_thread_t.
00102       ACE_OS::sprintf (name,
00103                        ACE_LIB_TEXT ("/%s/%u/%lu"),
00104                        host_name,
00105                        ACE_static_cast (u_int, ACE_OS::getpid ()),
00106                        *ACE_reinterpret_cast (u_long *, &thread_id));
00107 
00108       this->client_id (name);
00109     }
00110 }

ACE_TPQ_Entry::ACE_TPQ_Entry const ACE_TPQ_Entry &    rhs
 

Copy constructor.

Definition at line 121 of file Local_Tokens.cpp.

References ACE_TRACE.

00122 : cond_var_ (lock_)
00123 {
00124   ACE_TRACE ("ACE_TPQ_Entry::ACE_TPQ_Entry copy const.");
00125   *this = rhs;
00126 }

ACE_TPQ_Entry::~ACE_TPQ_Entry void   
 

Destructor.

Definition at line 128 of file Local_Tokens.cpp.

References ACE_TRACE.

00129 {
00130   ACE_TRACE ("ACE_TPQ_Entry::~ACE_TPQ_Entry");
00131 }


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 146 of file Local_Tokens.cpp.

References ACE_MAXCLIENTIDLEN, ACE_TCHAR, ACE_TRACE, and ACE_OS_String::strsncpy.

00147 {
00148   ACE_TRACE ("ACE_TPQ_Entry::client_id");
00149 
00150   if (id == 0)
00151     return;
00152 
00153   ACE_OS::strsncpy (this->client_id_,
00154                     (ACE_TCHAR *) id,
00155                     ACE_MAXCLIENTIDLEN);
00156 }

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 57 of file Local_Tokens.cpp.

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

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

00058 {
00059   ACE_TRACE ("ACE_TPQ_Entry::dump");
00060   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00061   ACE_DEBUG ((LM_DEBUG,
00062               ACE_LIB_TEXT ("ACE_TPQ_Entry::dump:\n")
00063               ACE_LIB_TEXT (" nesting_level_ = %d\n")
00064               ACE_LIB_TEXT (" client_id_ = %s\n"),
00065               nesting_level_,
00066               client_id_));
00067 
00068   if (next_ != 0)
00069     {
00070       ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("next:.\n")));
00071       next_->dump ();
00072     }
00073 
00074   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("ACE_TPQ_Entry::dump end.\n")));
00075   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00076 }

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 134 of file Local_Tokens.cpp.

References ACE_TRACE, client_id, nesting_level, nesting_level_, proxy, proxy_, sleep_hook, and sleep_hook_.

00135 {
00136   ACE_TRACE ("ACE_TPQ_Entry::operator=");
00137   if (&rhs == this)
00138     return;
00139   this->proxy_ = rhs.proxy ();
00140   this->nesting_level_ = rhs.nesting_level ();
00141   this->client_id (rhs.client_id ());
00142   this->sleep_hook_ = rhs.sleep_hook ();
00143 }

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 104 of file Local_Tokens.h.


Member Data Documentation

void* ACE_TPQ_Entry::arg_ [private]
 

Arg.

Definition at line 184 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 187 of file Local_Tokens.h.

Referenced by dump.

ACE_TOKEN_CONST::COND_VAR ACE_TPQ_Entry::cond_var_
 

Definition at line 161 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 162 of file Local_Tokens.h.

int ACE_TPQ_Entry::nesting_level_ [private]
 

Nesting level.

Definition at line 181 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 165 of file Local_Tokens.h.

Referenced by ACE_RW_Token::acquire, ACE_TPQ_Iterator::advance, ACE_Token_Proxy_Queue::dequeue, dump, 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 178 of file Local_Tokens.h.

Referenced by operator=.

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 175 of file Local_Tokens.h.


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