ACE  6.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
ACE_Remote_Token_Proxy Class Reference

Proxy for acquiring, renewing, and releasing a distributed synchronization token. More...

#include <Remote_Tokens.h>

Inheritance diagram for ACE_Remote_Token_Proxy:
Inheritance graph
[legend]
Collaboration diagram for ACE_Remote_Token_Proxy:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_Remote_Token_Proxy (void)
 Null construction.
virtual ~ACE_Remote_Token_Proxy (void)
 Death.
int open (const ACE_TCHAR *name, int ignore_deadlock=0, int debug=0)
int initiate_connection (void)
virtual int acquire (int notify=0, void(*sleep_hook)(void *)=0, ACE_Synch_Options &options=ACE_Synch_Options::synch)
virtual int tryacquire (void(*sleep_hook)(void *)=0)
virtual int renew (int requeue_position=0, ACE_Synch_Options &options=ACE_Synch_Options::synch)
virtual int release (ACE_Synch_Options &options=ACE_Synch_Options::synch)
virtual int remove (ACE_Synch_Options &options=ACE_Synch_Options::synch)
virtual void token_acquired (ACE_TPQ_Entry *)
 Override the default to do nothing.
virtual const ACE_TCHARowner_id (void)
 The client id of the current token holder.
void dump (void) const
 Dump the state of the class.
- Public Member Functions inherited from ACE_Token_Proxy
 ACE_Token_Proxy (void)
 Construction.
virtual ~ACE_Token_Proxy (void)
 Destructor.
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_TCHARclient_id (void) const
virtual void client_id (const ACE_TCHAR *client_id)
virtual const ACE_TCHARname (void) const
virtual void sleep_hook (void)
virtual ACE_Token_Proxyclone (void) const =0
 Return a dynamically allocated clone of the derived class.
virtual int type (void) const

Static Public Member Functions

static void set_server_address (const ACE_INET_Addr &server_address)

Protected Member Functions

int request_reply (ACE_Token_Request &request, ACE_Synch_Options &options)
 Perform the request and wait for the reply.
- Protected Member Functions inherited from ACE_Token_Proxy
 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_Tokenscreate_token (const ACE_TCHAR *name)=0

Protected Attributes

int ignore_shadow_deadlock_
 If shadows report deadlock, go remote anyway.
- Protected Attributes inherited from ACE_Token_Proxy
int ignore_deadlock_
 If this is set, we ignore deadlock.
int debug_
 Print a bunch of debug messages.
ACE_Tokenstoken_
ACE_TSS_TPQ_Entry waiter_
 Waiter info used for asynchronous transactions.

Detailed Description

Proxy for acquiring, renewing, and releasing a distributed synchronization token.

The Remote_Token_Proxy class implements the mechanisms for distributed token operations. It is similar to the ACE_Token_Proxy.

Todo:
Distributed sleep_hooks have not been implemented. <owner_id> is not implemented.

Constructor & Destructor Documentation

ACE_Remote_Token_Proxy::ACE_Remote_Token_Proxy ( void  )

Null construction.

ACE_Remote_Token_Proxy::~ACE_Remote_Token_Proxy ( void  )
virtual

Death.


Member Function Documentation

int ACE_Remote_Token_Proxy::acquire ( int  notify = 0,
void(*)(void *)  sleep_hook = 0,
ACE_Synch_Options options = ACE_Synch_Options::synch 
)
virtual

Acquire the distributed token. If notify is specified and the token is already held, the owner is notified. options contains the timeout value for the acquire call. The timer is kept at the token server. Asynchronous operations are not supported. Returns 0 on success, -1 on failure with errno == problem.

Reimplemented from ACE_Token_Proxy.

void ACE_Remote_Token_Proxy::dump ( void  ) const

Dump the state of the class.

Reimplemented from ACE_Token_Proxy.

Reimplemented in ACE_Remote_WLock, ACE_Remote_RLock, and ACE_Remote_Mutex.

int ACE_Remote_Token_Proxy::initiate_connection ( void  )

Open a connection with the token server. This only need be used when the user wishes to explicitly open a connection to check if the server exists. Connections are stored in the ACE_Token_Connections singleton as thread-specific data. That is, every thread has only one connection that is used for all remote tokens.

int ACE_Remote_Token_Proxy::open ( const ACE_TCHAR name,
int  ignore_deadlock = 0,
int  debug = 0 
)
virtual

Same as Token_Proxy. name is the string uniquely identifying the token. ignore_deadlock can be 1 to disable deadlock notifications. debug prints debug messages.

Reimplemented from ACE_Token_Proxy.

const ACE_TCHAR * ACE_Remote_Token_Proxy::owner_id ( void  )
virtual

The client id of the current token holder.

Reimplemented from ACE_Token_Proxy.

int ACE_Remote_Token_Proxy::release ( ACE_Synch_Options options = ACE_Synch_Options::synch)
virtual

Release the distributed token. Similar to ACE_Local_Mutex, if the caller is not the owner, it is removed from the waiter list (if applicable.) Returns 0 on success, -1 on failure with errno == problem.

Reimplemented from ACE_Token_Proxy.

int ACE_Remote_Token_Proxy::remove ( ACE_Synch_Options options = ACE_Synch_Options::synch)
virtual

Become interface compliant for our guards. This has no functionality.

Reimplemented from ACE_Token_Proxy.

int ACE_Remote_Token_Proxy::renew ( int  requeue_position = 0,
ACE_Synch_Options options = ACE_Synch_Options::synch 
)
virtual

Renew the token by offering to release it if there are any other waiters, otherwise get the token back immediately. This renew has the same semantics as ACE_Local_Mutex release. It is semantically equivalent to release() followed by acquire(), but it is faster. options contains the timeout value used if renew blocks. As with acquire, the timer is maintained at the token server. If there are waiters and requeue_position == -1, the caller is queued at the rear of the waiter list. Otherwise, requeue_position specifies the number of waiters to "let by" before reacquiring the token (effectively, the position in the waiter list.)

Reimplemented from ACE_Token_Proxy.

int ACE_Remote_Token_Proxy::request_reply ( ACE_Token_Request request,
ACE_Synch_Options options 
)
protected

Perform the request and wait for the reply.

void ACE_Remote_Token_Proxy::set_server_address ( const ACE_INET_Addr server_address)
static

Sets the server address for all instances of ACE_Remote_Token_Proxy If this isn't called, the environment variable TOKEN_SERVER is checked for the server address. If that is not specified, all ACE_Remote_** operations will fail.

void ACE_Remote_Token_Proxy::token_acquired ( ACE_TPQ_Entry )
virtual

Override the default to do nothing.

Reimplemented from ACE_Token_Proxy.

int ACE_Remote_Token_Proxy::tryacquire ( void(*)(void *)  sleep_hook = 0)
virtual

Try to acquire the distributed token. If the token is already held, the call returns without queuing the caller as a waiter. Returns 0 on success (the token was acquired), and -1 with EWOULDBLOCK if the token was already held.

Reimplemented from ACE_Token_Proxy.


Member Data Documentation

int ACE_Remote_Token_Proxy::ignore_shadow_deadlock_
protected

If shadows report deadlock, go remote anyway.


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