Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Token_Proxy Class Reference

Abstract representation of ACE tokens. More...

`#include <Local_Tokens.h>`

Inheritance diagram for ACE_Token_Proxy:

[legend]
Collaboration diagram for ACE_Token_Proxy:

[legend]
List of all members.

## Public Methods
| ACE_Token_Proxy (void)
| Construction. More...
virtual | ~ACE_Token_Proxy (void)
| Destructor. More...
virtual int | open (const ACE_TCHAR *name, int ignore_deadlock=0, int debug=0)
| Open the <ACE_Token>. More...
virtual int | acquire (int notify=0, void(*sleep_hook)(void *)=0, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Calls acquire on the token. Blocks the calling thread if would block. More...
virtual int | renew (int requeue_position=-1, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Calls renew on the token. Blocks the calling thread if would block. More...
virtual int | tryacquire (void(*sleep_hook)(void *)=0)
| Calls renew on the token. More...
virtual int | release (ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Calls release on the token. More...
virtual int | remove (ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Calls remove on the token. More...
virtual int | acquire_read (int notify=0, void(*sleep_hook)(void *)=0, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Since the locking mechanism doesn't support read locks then this just calls <acquire>. More...
virtual int | acquire_write (int notify=0, void(*sleep_hook)(void *)=0, ACE_Synch_Options &options=ACE_Synch_Options::defaults)
| Since the locking mechanism doesn't support write locks then this just calls <acquire>. More...
virtual int | tryacquire_read (void(*sleep_hook)(void *)=0)
| Since the locking mechanism doesn't support read locks then this just calls <tryacquire>. More...
virtual int | tryacquire_write (void(*sleep_hook)(void *)=0)
| Since the locking mechanism doesn't support write locks then this just calls <tryacquire>. More...
virtual const ACE_TCHAR * | client_id (void) const
| Get the client id of the proxy. This is implemented as thread-specific data. More...
virtual void | client_id (const ACE_TCHAR *client_id)
| Set the client_id for the calling thread. More...
virtual const ACE_TCHAR * | name (void) const
| Return the name of the token. More...
virtual void | sleep_hook (void)
| This should really be called <someone_waiting>. More...
virtual void | token_acquired (ACE_TPQ_Entry *)
| This is called when a queued (waiting) proxy is removed from the waiters list and given the token. More...
virtual const ACE_TCHAR * | owner_id (void)
| The client id of the current token holder. More...
virtual ACE_Token_Proxy * | clone (void) const=0
| Return a dynamically allocated clone of the derived class. More...
void | dump (void) const
| Dump the state of the class. More...
virtual int | type (void) const
| This method can be used be Tokens (e.g. More...
## Protected Methods
| ACE_Token_Proxy (const ACE_Token_Proxy &)
| Duplication. More...
int | handle_options (ACE_Synch_Options &options, ACE_TOKEN_CONST::COND_VAR &cv)
| Handles cond_var waits. More...
virtual ACE_Tokens * | create_token (const ACE_TCHAR *name)=0
| Make the correct type of ACE_Tokens. This is called by the Token Manager. More...
## Protected Attributes
int | ignore_deadlock_
| If this is set, we ignore deadlock. More...
int | debug_
| Print a bunch of debug messages. More...
ACE_Tokens * | token_
| Reference to the actual logical token. Many ACE_Local_Mutex proxies can reference the same ACE_Mutex_Token. More...
ACE_TSS_TPQ_Entry | waiter_
| Waiter info used for asynchronous transactions. More...
## Friends
class | ACE_Token_Manager
class | ACE_Token_Invariant_Manager

## Detailed Description

Abstract representation of ACE tokens.

Interface for all Tokens in ACE. This class implements the synchronization needed for tokens (condition variables etc.) The algorithms for the operations (acquire, release, etc.) operate on the generic ACE_Tokens interface. Thus, the _type_ of token (mutex, rwlock) can be set at construction of ACE_Token_Proxy. You can use all Tokens in ACE through the ACE_Token_Proxy by passing the proper values at construction. Alternatively, there are class definitions which "know" how to do this (ACE_Local_Mutex, ACE_Local_RLock, ACE_Local_WLock). To add a new type of token (e.g. semaphore), this class is not changed. See ACE_Token_Manager for details. Tokens (e.g. ACE_Mutex_Token) assume that it can always call <ACE_Token_Proxy::token_acquired> on a new token owner. This is not a problem for synchronous use of token proxies (that is, when acquires block until successful.) However, for implementations of the Token Server, which may use asynch operations, the proxy can not go away after an acquire until the token is acquired. This is not really a problem, but should be understood.

## Constructor & Destructor Documentation

ACE_Token_Proxy::ACE_Token_Proxy | ( | void |  | ) |

| Construction.

ACE_Token_Proxy::~ACE_Token_Proxy | ( | void |  | ) | `[virtual]`

| Destructor.

ACE_Token_Proxy::ACE_Token_Proxy | ( | const ACE_Token_Proxy & |  | ) | `[protected]`

| Duplication.

## Member Function Documentation

int ACE_Token_Proxy::acquire | ( | int | notify = 0,
|  | void(* | sleep_hook)(void *) = 0,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Calls acquire on the token. Blocks the calling thread if would block. Reimplemented in ACE_Null_Token, ACE_Remote_Token_Proxy, and ACE_Token_Collection.

virtual int ACE_Token_Proxy::acquire_read | ( | int | notify = 0,
|  | void(* | sleep_hook)(void *) = 0,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Since the locking mechanism doesn't support read locks then this just calls <acquire>.

virtual int ACE_Token_Proxy::acquire_write | ( | int | notify = 0,
|  | void(* | sleep_hook)(void *) = 0,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Since the locking mechanism doesn't support write locks then this just calls <acquire>.

void ACE_Token_Proxy::client_id | ( | const ACE_TCHAR * | client_id | ) | `[virtual]`

| Set the client_id for the calling thread. I strongly recommend that this not be used unless you really know what you're doing. I use this in the Token Server, and it caused many headaches.

const ACE_TCHAR * ACE_Token_Proxy::client_id | ( | void |  | ) | const`[virtual]`

| Get the client id of the proxy. This is implemented as thread-specific data.

virtual ACE_Token_Proxy* ACE_Token_Proxy::clone | ( | void |  | ) | const`[pure virtual]`

| Return a dynamically allocated clone of the derived class. Reimplemented in ACE_Null_Token, ACE_Local_Mutex, ACE_Local_RLock, ACE_Local_WLock, ACE_Remote_Mutex, ACE_Remote_RLock, ACE_Remote_WLock, and ACE_Token_Collection.

virtual ACE_Tokens* ACE_Token_Proxy::create_token | ( | const ACE_TCHAR * | name | ) | `[protected, pure virtual]`

| Make the correct type of ACE_Tokens. This is called by the Token Manager. Reimplemented in ACE_Null_Token, ACE_Local_Mutex, ACE_Local_RLock, ACE_Local_WLock, ACE_Remote_Mutex, ACE_Remote_RLock, ACE_Remote_WLock, and ACE_Token_Collection.

void ACE_Token_Proxy::dump | ( | void |  | ) | const

| Dump the state of the class. Reimplemented in ACE_Null_Token, ACE_Local_Mutex, ACE_Local_RLock, ACE_Local_WLock, ACE_Remote_Token_Proxy, ACE_Remote_Mutex, ACE_Remote_RLock, ACE_Remote_WLock, and ACE_Token_Collection.

int ACE_Token_Proxy::handle_options | ( | ACE_Synch_Options & | options,
|  | ACE_TOKEN_CONST::COND_VAR & | cv
| ) | `[protected]`

| Handles cond_var waits.

const ACE_TCHAR * ACE_Token_Proxy::name | ( | void |  | ) | const`[virtual]`

| Return the name of the token. This is important for use within the token servers (local and remote) as well as with token collections. So, all derivations of ACE_Token_Proxy must be able to stringify some name. The name must uniquely identify a token. So, for instance, the token within the reactor should probably be called "Reactor Token." Reimplemented in ACE_Token_Collection.

int ACE_Token_Proxy::open | ( | const ACE_TCHAR * | name,
|  | int | ignore_deadlock = 0,
|  | int | debug = 0
| ) | `[virtual]`

  | Open the <ACE_Token>. Parameters:
  name | The string uniquely identifying the token.
  ignore_deadlock | Can be 1 to disable deadlock notifications.
  debug | Prints debug messages.
Reimplemented in ACE_Remote_Token_Proxy.

const ACE_TCHAR * ACE_Token_Proxy::owner_id | ( | void |  | ) | `[virtual]`

| The client id of the current token holder. Reimplemented in ACE_Remote_Token_Proxy.

int ACE_Token_Proxy::release | ( | ACE_Synch_Options & | options = ACE_Synch_Options::defaults | ) | `[virtual]`

| Calls release on the token. Reimplemented in ACE_Null_Token, ACE_Remote_Token_Proxy, and ACE_Token_Collection.

int ACE_Token_Proxy::remove | ( | ACE_Synch_Options & | options = ACE_Synch_Options::defaults | ) | `[virtual]`

| Calls remove on the token. Reimplemented in ACE_Null_Token, and ACE_Remote_Token_Proxy.

int ACE_Token_Proxy::renew | ( | int | requeue_position = -1,
|  | ACE_Synch_Options & | options = ACE_Synch_Options::defaults
| ) | `[virtual]`

| Calls renew on the token. Blocks the calling thread if would block. Reimplemented in ACE_Null_Token, ACE_Remote_Token_Proxy, and ACE_Token_Collection.

void ACE_Token_Proxy::sleep_hook | ( | void |  | ) | `[virtual]`

| This should really be called <someone_waiting>. This is called by ACE_Token_xx's when another proxy enters the waiting list and requests that the current token holder be notified.

void ACE_Token_Proxy::token_acquired | ( | ACE_TPQ_Entry * | e | ) | `[virtual]`

| This is called when a queued (waiting) proxy is removed from the waiters list and given the token. Reimplemented in ACE_Remote_Token_Proxy.

int ACE_Token_Proxy::tryacquire | ( | void(* | sleep_hook)(void *) = 0 | ) | `[virtual]`

| Calls renew on the token. Reimplemented in ACE_Null_Token, ACE_Remote_Token_Proxy, and ACE_Token_Collection.

virtual int ACE_Token_Proxy::tryacquire_read | ( | void(* | sleep_hook)(void *) = 0 | ) | `[virtual]`

| Since the locking mechanism doesn't support read locks then this just calls <tryacquire>.

virtual int ACE_Token_Proxy::tryacquire_write | ( | void(* | sleep_hook)(void *) = 0 | ) | `[virtual]`

| Since the locking mechanism doesn't support write locks then this just calls <tryacquire>.

virtual int ACE_Token_Proxy::type | ( | void |  | ) | const`[virtual]`

| This method can be used be Tokens (e.g. Readers/Writer Tokens) to distinguish between Proxy types. For instance a Reader proxy should return a different type value than a Writer proxy. The default implementation returns 0. Reimplemented in ACE_Local_RLock, ACE_Local_WLock, ACE_Remote_RLock, and ACE_Remote_WLock.

## Friends And Related Function Documentation

friend class ACE_Token_Invariant_Manager`[friend]`

friend class ACE_Token_Manager`[friend]`

## Member Data Documentation

int ACE_Token_Proxy::debug_`[protected]`

| Print a bunch of debug messages. Reimplemented in ACE_Token_Collection.

int ACE_Token_Proxy::ignore_deadlock_`[protected]`

| If this is set, we ignore deadlock.

ACE_Tokens* ACE_Token_Proxy::token_`[protected]`

| Reference to the actual logical token. Many ACE_Local_Mutex proxies can reference the same ACE_Mutex_Token.

ACE_TSS_TPQ_Entry ACE_Token_Proxy::waiter_`[protected]`

| Waiter info used for asynchronous transactions.

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

- Local_Tokens.h
- Local_Tokens.cpp