ACE  6.3.2
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ACE_Token_Manager Class Reference

Manages all tokens in a process space. More...

#include <Token_Manager.h>

Inheritance diagram for ACE_Token_Manager:
Inheritance graph
[legend]
Collaboration diagram for ACE_Token_Manager:
Collaboration graph
[legend]

Public Member Functions

 ACE_Token_Manager (void)
 
virtual ~ACE_Token_Manager (void)
 
void instance (ACE_Token_Manager *)
 Set the pointer to token manager singleton. More...
 
void get_token (ACE_Token_Proxy *, const ACE_TCHAR *token_name)
 
int check_deadlock (ACE_Token_Proxy *proxy)
 
int check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy)
 
void release_token (ACE_Tokens *&token)
 
ACE_TOKEN_CONST::MUTEXmutex (void)
 
void dump (void) const
 Dump the state of the class. More...
 
void debug (bool d)
 Turn debug mode on/off. More...
 
- Public Member Functions inherited from ACE_Cleanup
 ACE_Cleanup (void)
 No-op constructor. More...
 
virtual ~ACE_Cleanup (void)
 Destructor. More...
 
virtual void cleanup (void *param=0)
 Cleanup method that, by default, simply deletes itself. More...
 

Static Public Member Functions

static ACE_Token_Managerinstance (void)
 Get the pointer to token manager singleton. More...
 

Private Types

typedef ACE_Token_Name TOKEN_NAME
 This may be changed to a template type. More...
 
typedef ACE_Map_Manager< TOKEN_NAME, ACE_Tokens *, ACE_Null_MutexCOLLECTION
 COLLECTION maintains a mapping from token names to ACE_Tokens*. More...
 

Private Member Functions

ACE_Tokenstoken_waiting_for (const ACE_TCHAR *client_id)
 Return the token that the given client_id is waiting for, if any. More...
 

Private Attributes

bool debug_
 Whether to print debug messages or not. More...
 
ACE_TOKEN_CONST::MUTEX lock_
 ACE_Mutex_Token used to lock internal data structures. More...
 
COLLECTION collection_
 COLLECTION maintains a mapping from token names to ACE_Tokens*. More...
 

Static Private Attributes

static ACE_Token_Managertoken_manager_ = 0
 pointer to singleton token manager. More...
 

Detailed Description

Manages all tokens in a process space.

Factory: Proxies use the token manager to obtain token references. This allows multiple proxies to reference the same logical token. Deadlock detection: Tokens use the manager to check for deadlock situations during acquires.

Member Typedef Documentation

COLLECTION maintains a mapping from token names to ACE_Tokens*.

This may be changed to a template type.

Constructor & Destructor Documentation

ACE_Token_Manager::ACE_Token_Manager ( void  )
ACE_Token_Manager::~ACE_Token_Manager ( void  )
virtual

Member Function Documentation

int ACE_Token_Manager::check_deadlock ( ACE_Token_Proxy proxy)

Check whether acquire will cause deadlock or not. returns 1 if the acquire will not cause deadlock. returns 0 if the acquire will cause deadlock. This method ignores recursive acquisition. That is, it will not report deadlock if the client holding the token requests the token again. Thus, it assumes recursive mutexes.

int ACE_Token_Manager::check_deadlock ( ACE_Tokens token,
ACE_Token_Proxy proxy 
)
void ACE_Token_Manager::debug ( bool  d)
inline

Turn debug mode on/off.

void ACE_Token_Manager::dump ( void  ) const

Dump the state of the class.

void ACE_Token_Manager::get_token ( ACE_Token_Proxy proxy,
const ACE_TCHAR token_name 
)

The Token manager uses ACE_Token_Proxy::token_id_ to look for an existing token. If none is found, the Token Manager calls ACE_Token_Proxy::create_token to create a new one. When finished, sets ACE_Token_Proxy::token_. token_name uniquely id's the token name.

ACE_Token_Manager * ACE_Token_Manager::instance ( void  )
static

Get the pointer to token manager singleton.

void ACE_Token_Manager::instance ( ACE_Token_Manager )

Set the pointer to token manager singleton.

ACE_TOKEN_CONST::MUTEX & ACE_Token_Manager::mutex ( void  )
inline

This is to allow Tokens to perform atomic transactions. The typical usage is to acquire this mutex, check for a safe_acquire, perform some queueing (if need be) and then release the lock. This is necessary since safe_acquire is implemented in terms of the Token queues.

void ACE_Token_Manager::release_token ( ACE_Tokens *&  token)

Notify the token manager that a token has been released. If as a result, there is no owner of the token, the token is deleted.

ACE_Tokens * ACE_Token_Manager::token_waiting_for ( const ACE_TCHAR client_id)
private

Return the token that the given client_id is waiting for, if any.

Member Data Documentation

COLLECTION ACE_Token_Manager::collection_
private

COLLECTION maintains a mapping from token names to ACE_Tokens*.

bool ACE_Token_Manager::debug_
private

Whether to print debug messages or not.

ACE_TOKEN_CONST::MUTEX ACE_Token_Manager::lock_
private

ACE_Mutex_Token used to lock internal data structures.

ACE_Token_Manager * ACE_Token_Manager::token_manager_ = 0
staticprivate

pointer to singleton token manager.


The documentation for this class was generated from the following files: