ACE
6.3.3
|
Abstract representation of ACE tokens. More...
#include <Local_Tokens.h>
Public Member Functions | |
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) |
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. 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) |
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. 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 |
Protected Member Functions | |
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 |
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_ |
ACE_TSS_TPQ_Entry | waiter_ |
Waiter info used for asynchronous transactions. More... | |
Friends | |
class | ACE_Token_Manager |
class | ACE_Token_Invariant_Manager |
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.
ACE_Token_Proxy::ACE_Token_Proxy | ( | void | ) |
Construction.
|
virtual |
Destructor.
|
protected |
Duplication.
|
virtual |
Calls acquire on the token. Blocks the calling thread if would block.
Reimplemented in ACE_Null_Token, ACE_Token_Collection, and ACE_Remote_Token_Proxy.
|
virtual |
Since the locking mechanism doesn't support read locks then this just calls <acquire>.
|
virtual |
Since the locking mechanism doesn't support write locks then this just calls <acquire>.
|
virtual |
Get the client id of the proxy. This is implemented as thread-specific data.
|
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.
|
pure virtual |
Return a dynamically allocated clone of the derived class.
Implemented in ACE_Local_WLock, ACE_Local_RLock, ACE_Local_Mutex, ACE_Null_Token, ACE_Remote_WLock, ACE_Remote_RLock, ACE_Token_Collection, and ACE_Remote_Mutex.
|
protectedpure virtual |
Make the correct type of ACE_Tokens. This is called by the Token Manager.
Implemented in ACE_Local_WLock, ACE_Local_RLock, ACE_Local_Mutex, ACE_Null_Token, ACE_Remote_WLock, ACE_Remote_RLock, ACE_Token_Collection, and ACE_Remote_Mutex.
void ACE_Token_Proxy::dump | ( | void | ) | const |
Dump the state of the class.
|
protected |
Handles cond_var waits.
|
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.
|
virtual |
Open the <ACE_Token>.
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.
|
virtual |
The client id of the current token holder.
Reimplemented in ACE_Remote_Token_Proxy.
|
virtual |
Calls release on the token.
Reimplemented in ACE_Null_Token, ACE_Token_Collection, and ACE_Remote_Token_Proxy.
|
virtual |
Calls remove on the token.
Reimplemented in ACE_Null_Token, and ACE_Remote_Token_Proxy.
|
virtual |
Calls renew on the token. Blocks the calling thread if would block.
Reimplemented in ACE_Null_Token, ACE_Token_Collection, and ACE_Remote_Token_Proxy.
|
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.
|
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.
|
virtual |
Calls renew on the token.
Reimplemented in ACE_Null_Token, ACE_Token_Collection, and ACE_Remote_Token_Proxy.
|
virtual |
Since the locking mechanism doesn't support read locks then this just calls <tryacquire>.
|
virtual |
Since the locking mechanism doesn't support write locks then this just calls <tryacquire>.
|
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_WLock, ACE_Local_RLock, ACE_Remote_WLock, and ACE_Remote_RLock.
|
friend |
|
friend |
|
protected |
Print a bunch of debug messages.
|
protected |
If this is set, we ignore deadlock.
|
protected |
Reference to the actual logical token. Many ACE_Local_Mutex proxies can reference the same ACE_Mutex_Token.
|
protected |
Waiter info used for asynchronous transactions.