ACE_Local_RLock Class Reference

Class that acquires, renews, and releases a readers lock that is local to the process. More...

#include <Local_Tokens.h>

Inheritance diagram for ACE_Local_RLock:

Inheritance graph
[legend]
Collaboration diagram for ACE_Local_RLock:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Local_RLock (const ACE_TCHAR *token_name=0, int ignore_deadlock=0, int debug=0)
 ~ACE_Local_RLock (void)
 Destructor.

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

virtual int type (void) const
 Returns ACE_RW_Token::RLOCK.

virtual ACE_Token_Proxyclone (void) const
 Return deep copy.


Protected Member Functions

virtual ACE_Tokenscreate_token (const ACE_TCHAR *name)
 Return a new ACE_Local_Mutex.


Detailed Description

Class that acquires, renews, and releases a readers lock that is local to the process.

This class implements the reader interface to canonical readers/writer locks. Multiple readers can hold the lock simultaneously when no writers have the lock. Alternatively, when a writer holds the lock, no other participants (readers or writers) may hold the lock. This class is a more general-purpose synchronization mechanism than SunOS 5.x RLocks. For example, it implements "recursive RLock" semantics, where a thread that owns the token can reacquire it without deadlocking. In addition, threads that are blocked awaiting the token are serviced in strict FIFO order as other threads release the token (SunOS 5.x RLockes don't strictly enforce an acquisition order). The interfaces for acquire, tryacquire, renew, release, etc. are defined in ACE_Token_Proxy. The semantics for ACE_Local_RLock are that of a readers/writers lock. Acquire for this class implies a reader acquisition. That is, multiple clients may acquire a lock for read only.

Definition at line 1024 of file Local_Tokens.h.


Constructor & Destructor Documentation

ACE_Local_RLock::ACE_Local_RLock const ACE_TCHAR token_name = 0,
int  ignore_deadlock = 0,
int  debug = 0
 

Constructor.

Parameters:
token_name Uniquely id's the token.
ignore_deadlock Will allow deadlock to occur (useful for testing).
debug Prints a bunch of messages.

ACE_Local_RLock::~ACE_Local_RLock void   ) 
 

Destructor.

Definition at line 1548 of file Local_Tokens.cpp.

01549 {
01550 }


Member Function Documentation

ACE_Token_Proxy * ACE_Local_RLock::clone void   )  const [virtual]
 

Return deep copy.

Implements ACE_Token_Proxy.

Definition at line 1569 of file Local_Tokens.cpp.

References ACE_NEW_RETURN, and ACE_Tokens::name().

01570 {
01571   ACE_Token_Proxy *temp = 0;
01572   ACE_NEW_RETURN (temp,
01573                   ACE_Local_RLock (token_->name (),
01574                                    ignore_deadlock_,
01575                                    debug_),
01576                   0);
01577   return temp;
01578 }

ACE_Tokens * ACE_Local_RLock::create_token const ACE_TCHAR name  )  [protected, virtual]
 

Return a new ACE_Local_Mutex.

Implements ACE_Token_Proxy.

Definition at line 1553 of file Local_Tokens.cpp.

References ACE_NEW_RETURN, and ACE_TCHAR.

01554 {
01555   ACE_Tokens *temp = 0;
01556   ACE_NEW_RETURN (temp,
01557                   ACE_RW_Token (name),
01558                   0);
01559   return temp;
01560 }

void ACE_Local_RLock::dump void   )  const
 

Dump the state of the class.

Reimplemented from ACE_Token_Proxy.

int ACE_Local_RLock::type void   )  const [virtual]
 

Returns ACE_RW_Token::RLOCK.

Reimplemented from ACE_Token_Proxy.

Definition at line 1563 of file Local_Tokens.cpp.

01564 {
01565   return ACE_RW_Token::READER;
01566 }


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