NAME

ACE_Token_Manager - Manages all tokens in a process space.

SYNOPSIS


#include <ace/Token_Manager>


class ACE_Token_Manager
{
  public:
    ACE_Token_Manager (void);
    ~ACE_Token_Manager (void);
    static ACE_Token_Manager *instance (void);
    void instance (ACE_Token_Manager *);
    void get_token (ACE_Token_Proxy *, const char *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::MUTEX &mutex (void);
    void dump (void) const;
    void debug (int d);
  private:
    int debug_;
    static ACE_Token_Manager *token_manager_;
    static ACE_TOKEN_CONST::MUTEX creation_lock_;
    ACE_Tokens *token_waiting_for (const char *client_id);
    ACE_TOKEN_CONST::MUTEX lock_;
    typedef ACE_Token_Name TOKEN_NAME;
        typedef ACE_Map_Manager<TOKEN_NAME, ACE_Tokens *, ACE_Null_Mutex> COLLECTION;
        
        typedef ACE_Map_Iterator<TOKEN_NAME, ACE_Tokens *, ACE_Null_Mutex> COLLECTION_ITERATOR;
        
    typedef ACE_Map_Entry<TOKEN_NAME, ACE_Tokens *> COLLECTION_ENTRY;
    COLLECTION collection_;
};

DESCRIPTION

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.

PUBLIC MEMBERS

ACE_Token_Manager (void);
~ACE_Token_Manager (void);
static ACE_Token_Manager *instance (void);
void instance (ACE_Token_Manager *);
void get_token (ACE_Token_Proxy *, const char *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::MUTEX &mutex (void);
void dump (void) const;
void debug (int d);

PRIVATE MEMBERS

int debug_;
static ACE_Token_Manager *token_manager_;
static ACE_TOKEN_CONST::MUTEX creation_lock_;
ACE_Tokens *token_waiting_for (const char *client_id);
ACE_TOKEN_CONST::MUTEX lock_;
typedef ACE_Token_Name TOKEN_NAME;
    typedef ACE_Map_Manager<TOKEN_NAME, ACE_Tokens *, ACE_Null_Mutex> COLLECTION;
    
    typedef ACE_Map_Iterator<TOKEN_NAME, ACE_Tokens *, ACE_Null_Mutex> COLLECTION_ITERATOR;
    
typedef ACE_Map_Entry<TOKEN_NAME, ACE_Tokens *> COLLECTION_ENTRY;
COLLECTION collection_;

AUTHOR

Tim Harrison (harrison@cs.wustl.edu)

EXTENDING TOKENS

To add a new type of token (e.g. semaphore), do the following steps: 1. Create a new derivation of ACE_Token. This class defines the semantics of the new Token. 2. Create a derivation of ACE_Token_Manager. You will only need to redefine make_mutex.

LIBRARY

ace