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