*Backed out changeset 3be01fb200a5

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-17 15:51:44 -07:00
parent 26b5e033ff
commit e585187b24
2257 changed files with 103863 additions and 761 deletions
+56
View File
@@ -1,4 +1,5 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Remote_Tokens.h
@@ -9,20 +10,28 @@
* @author Tim Harrison ([email protected])
*/
//=============================================================================
#ifndef ACE_REMOTE_MUTEX_H
#define ACE_REMOTE_MUTEX_H
#include /**/ "ace/pre.h"
#include "ace/INET_Addr.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/SOCK_Connector.h"
#include "ace/SOCK_Stream.h"
#include "ace/Synch_Options.h"
#include "ace/Local_Tokens.h"
#include "ace/Token_Request_Reply.h"
#if defined (ACE_HAS_TOKENS_LIBRARY)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Remote_Token_Proxy
*
@@ -41,8 +50,10 @@ class ACE_Export ACE_Remote_Token_Proxy : public ACE_Token_Proxy
public:
/// Null construction.
ACE_Remote_Token_Proxy (void);
/// Death.
virtual ~ACE_Remote_Token_Proxy (void);
/**
* Same as Token_Proxy. @a name is the string uniquely identifying
* the token. <ignore_deadlock> can be 1 to disable deadlock
@@ -52,6 +63,7 @@ public:
int ignore_deadlock = 0,
int debug = 0);
/**
* Open a connection with the token server. This only need be used
* when the user wishes to explicitly open a connection to check if
@@ -61,6 +73,7 @@ public:
* remote tokens.
*/
int initiate_connection (void);
/**
* Acquire the distributed token. If notify is specified and the
* token is already held, the owner is notified. options contains
@@ -72,6 +85,7 @@ public:
void (*sleep_hook)(void *) = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::synch);
/**
* Try to acquire the distributed token. If the token is already
* held, the call returns without queueing the caller as a waiter.
@@ -79,6 +93,7 @@ public:
* EWOULDBLOCK if the token was already held.
*/
virtual int tryacquire (void (*sleep_hook)(void *) = 0);
/**
* Renew the token by offering to release it if there are any other
* waiters, otherwise get the token back immediately. This renew
@@ -95,6 +110,7 @@ public:
virtual int renew (int requeue_position = 0,
ACE_Synch_Options &options =
ACE_Synch_Options::synch);
/**
* Release the distributed token. Similar to ACE_Local_Mutex, if the
* caller is not the owner, it is removed from the waiter list (if
@@ -103,14 +119,18 @@ public:
*/
virtual int release (ACE_Synch_Options &options =
ACE_Synch_Options::synch);
/// Become interface compliant for ACE_Guard<>. This has no
/// functionality.
virtual int remove (ACE_Synch_Options &options =
ACE_Synch_Options::synch);
/// Override the default to do nothing.
virtual void token_acquired (ACE_TPQ_Entry *);
/// The client id of the current token holder
virtual const ACE_TCHAR* owner_id (void);
/**
* Sets the server address for all instances of ACE_Remote_Token_Proxy
* If this isn't called, the environment variable TOKEN_SERVER is
@@ -118,15 +138,20 @@ public:
* ACE_Remote_** operations will fail.
*/
static void set_server_address (const ACE_INET_Addr &server_address);
/// Dump the state of the class.
void dump (void) const;
protected:
/// If shadows report deadlock, go remote anyway
int ignore_shadow_deadlock_;
/// Perform the request and wait for the reply.
int request_reply (ACE_Token_Request &request,
ACE_Synch_Options &options);
};
/**
* @class ACE_Remote_Mutex
*
@@ -146,19 +171,24 @@ class ACE_Export ACE_Remote_Mutex : public ACE_Remote_Token_Proxy
public:
/// Null creation. Remote_Token_Proxy::open must be called.
ACE_Remote_Mutex (void);
/// Calls Remote_Token_Proxy::open for you.
ACE_Remote_Mutex (const ACE_TCHAR *token_name,
int ignore_deadlock = 0,
int debug = 0);
/// Dump the state of the class.
void dump (void) const;
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
protected:
/// Make the correct type of ACE_Tokens.
/// This is called by the ACE_Token_Manager.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
/**
* @class ACE_Remote_RLock
*
@@ -176,21 +206,28 @@ class ACE_Export ACE_Remote_RLock : public ACE_Remote_Token_Proxy
{
public:
ACE_Remote_RLock (void);
ACE_Remote_RLock (const ACE_TCHAR *token_name,
int ignore_deadlock = 0,
int debug = 0);
ACE_Remote_RLock (const ACE_Remote_RLock &mutex);
/// Dump the state of the class.
void dump (void) const;
/// Returns ACE_RW_Token::RLOCK;
virtual int type (void) const;
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
protected:
/// Make the correct type of ACE_Tokens. This is called by the Token
/// Manager.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
/**
* @class ACE_Remote_WLock
*
@@ -207,21 +244,28 @@ class ACE_Export ACE_Remote_WLock : public ACE_Remote_Token_Proxy
{
public:
ACE_Remote_WLock (void);
ACE_Remote_WLock (const ACE_TCHAR *token_name,
int ignore_deadlock = 0,
int debug = 0);
ACE_Remote_WLock (const ACE_Remote_WLock &mutex);
/// Dump the state of the class.
void dump (void) const;
/// Returns ACE_RW_Token::WLOCK;
virtual int type (void) const;
/// Return deep copy.
virtual ACE_Token_Proxy *clone (void) const;
protected:
/// Make the correct type of ACE_Tokens. This is called by the Token
/// Manager.
virtual ACE_Tokens *create_token (const ACE_TCHAR *name);
};
/**
* @class ACE_TSS_Connection
*
@@ -237,31 +281,43 @@ public:
// Necessary to make some compilers work...
ACE_TSS_Connection (void);
~ACE_TSS_Connection (void);
/// Retrieve the thread's connection
ACE_SOCK_Stream *get_connection (void);
/// Factory Method that creates a new SOCK Stream.
virtual ACE_SOCK_Stream *make_TSS_TYPE (void) const;
/// Inheritence and operator overloading don't mix. Redefine this
/// from ACE_TSS so that we can use it.
operator ACE_SOCK_Stream *(void);
/// Set the server address.
static void set_server_address (const ACE_INET_Addr &server_address);
/// Dump the state of the class.
void dump (void) const;
protected:
/// The address of the Token Server used by all instances of
/// Token_Proxy.
static ACE_INET_Addr server_address_;
private:
/// Private: should not be used
ACE_TSS_Connection (const ACE_TSS_Connection &);
void operator= (const ACE_TSS_Connection &);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_TOKENS_LIBRARY */
#if defined (__ACE_INLINE__)
#include "ace/Remote_Tokens.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_REMOTE_TOKEN_H */