NAME

ACE_Tokens - Abstract representation of ACE tokens.

SYNOPSIS

#include <ace/Local_Tokens.h>

class ACE_Tokens { public: ACE_Tokens (void); virtual ~ACE_Tokens (void); virtual int acquire ( ACE_TPQ_Entry *caller, int ignore_deadlock, int notify ) = 0; virtual int tryacquire (ACE_TPQ_Entry *caller) = 0; virtual int renew ( ACE_TPQ_Entry *caller, int requeue_position ) = 0; virtual int release (ACE_TPQ_Entry *caller) = 0; void make_owner (ACE_TPQ_Entry *caller); void remove (ACE_TPQ_Entry *caller); typedef ACE_Unbounded_Stack<ACE_TPQ_Entry *> OWNER_STACK; virtual int owners (OWNER_STACK &o, const ASYS_TCHAR *id) = 0; virtual int is_waiting_for (const ASYS_TCHAR *id) = 0; virtual int is_owner (const ASYS_TCHAR *id) = 0; virtual ACE_Token_Proxy_Queue *waiters (void); virtual int no_of_waiters (void); const ASYS_TCHAR *owner_id (void); const ASYS_TCHAR* name (void); void inc_reference (void); int dec_reference (void); void dump (void) const; enum TOKEN_TYPES { MUTEX, RWLOCK }; virtual int type (void) const = 0; void visit (int v); int visited (void); ACE_TPQ_Entry *owner (void); protected: int visited_; int reference_count_; ACE_Token_Proxy_Queue waiters_; ASYS_TCHAR token_name_[ACE_MAXTOKENNAMELEN]; };

DESCRIPTION

This file contains definitions for the following classes:

public: 7. ACE_Token_Proxy 8. ACE_Null_Token : public ACE_Token_Proxy 9. ACE_Local_Mutex : public ACE_Token_Proxy *. ACE_Local_RLock : public ACE_Local_Mutex &. ACE_Local_WLock : public ACE_Local_Mutex private: 1. ACE_TOKEN_CONST 3. ACE_TPQ_Entry b. ACE_TSS_TPQ_Entry c. ACE_TPQ_Iterator 4. ACE_Token_Proxy_Queue 5. ACE_Tokens 6. ACE_Mutex_Token : public ACE_Tokens 12. ACE_RW_Token : public ACE_Tokens a. ACE_Token_Name

Note that the locking classes defined in this file are *not* intended to be used as general-purpose synchronization mechanisms, such as mutexes or semaphores. Instead, you should use the ACE_Recursive_Thread_Mutex, ACE_Thread_Mutex, ACE_Thread_Semaphore, etc., that are defined in $ACE_ROOT/ace/Synch.h and $ACE_ROOT/ace/Synch_T.h or the ACE_Token that's defined in $ACE_ROOT/ace/Token.h.

Accessor methods.

typedef ACE_Unbounded_Stack<ACE_TPQ_Entry *> OWNER_STACK;

virtual int owners (OWNER_STACK &o, const ASYS_TCHAR *id) = 0;

virtual int is_waiting_for (const ASYS_TCHAR *id) = 0;

virtual int is_owner (const ASYS_TCHAR *id) = 0;

virtual ACE_Token_Proxy_Queue *waiters (void);

virtual int no_of_waiters (void);

const ASYS_TCHAR *owner_id (void);

const ASYS_TCHAR* name (void);

Reference counting. These are only called by the

Token_Manager.
void inc_reference (void);

int dec_reference (void);

void dump (void) const;

virtual int type (void) const = 0;

The following methods allow the deadlock detection algorithm to

check if this token has been visited.
void visit (int v);

int visited (void);

ACE_TPQ_Entry *owner (void);

AUTHOR

Karl-Heinz Dorn kdorn@erlh.siemens.de, Douglas C. Schmidt schmidt@cs.wustl.edu, and Tim Harrison harrison@cs.wustl.edu

LIBRARY

ace