Reference

ACE_Tokens(3)

Abstract representation of ACE tokens.

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;

Stack of owners.

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

Returns a stack of the current owners. Returns -1 on error, 0 on success. If id is non-zero, returns 1 if id is an owner.

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

Returns 1 if id is waiting for this token. 0 otherwise.

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

Returns 1 if id is an owner of this token. 0 otherwise.

virtual ACE_Token_Proxy_Queue *waiters (void);

Return the queue of waiters.

virtual int no_of_waiters (void);

Return the number of proxies that are currently waiting to get the token.

const ASYS_TCHAR *owner_id (void);

The current owner.

const ASYS_TCHAR* name (void);

Token name.

Reference counting. These are only called by the

Token_Manager.

void inc_reference (void);

int dec_reference (void);

void dump (void) const;

Dump the state of the class.

virtual int type (void) const = 0;

Provides a manual RTTI mechanism. This method is used only by ACE_Token_Request so that the type of a token can be sent to a remote Token Server.

The following methods allow the deadlock detection algorithm to

check if this token has been visited.

void visit (int v);

Mark or unmark the token as visited.

int visited (void);

Check if the token has been visited.

ACE_TPQ_Entry *owner (void);

All the data of the current owner.

AUTHOR

Karl-Heinz Dorn [email protected], Douglas C. Schmidt [email protected], and Tim Harrison [email protected]

LIBRARY

ace