#include <ACE/ACE_Token_Collection.h> class ACE_Token_Collection : public ACE_Token_Proxy {
public:
ACE_Token_Collection (int debug = 0, const char *name = 0);
int insert (ACE_Token_Proxy &token);
int extract (const char *token_name, ACE_Token_Proxy *&proxy);
ACE_Token_Proxy *is_member (const char *token_name);
int is_member (const ACE_Token_Proxy &token);
virtual int acquire (int notify = 0, void (*sleep_hook)( void *) = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults );
virtual int acquire (const char *token_name, int notify = 0, void (*sleep_hook)( void *) = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults );
virtual int tryacquire (void (*sleep_hook)(void *) = 0);
virtual int tryacquire (const char *token_name, void (*sleep_hook)( void *) = 0 );
virtual int renew ( int requeue_position = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults );
virtual int renew ( const char *token_name, int requeue_position = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults );
ACE_Synch_Options::defaults);
virtual int release ( const char *token_name, ACE_Synch_Options &options = ACE_Synch_Options::defaults );
~ACE_Token_Collection (void);
void dump (void) const;
virtual const char *name (void) const;
protected:
typedef ACE_Token_Name TOKEN_NAME;
typedef ACE_Map_Manager<TOKEN_NAME, ACE_Token_Proxy *, ACE_Null_Mutex> COLLECTION; typedef ACE_Map_Iterator<TOKEN_NAME, ACE_Token_Proxy *, ACE_Null_Mutex> COLLECTION_ITERATOR; typedef ACE_Map_Entry<TOKEN_NAME, ACE_Token_Proxy *> COLLECTION_ENTRY;COLLECTION collection_;
int debug_;
char name_[ACE_MAXTOKENNAMELEN];
virtual ACE_Token_Proxy *clone (void) const;
virtual ACE_Tokens *create_token (const char *name);
};
virtual int acquire (int notify = 0, void (*sleep_hook)(
void *) = 0,
ACE_Synch_Options &options = ACE_Synch_Options::defaults
);
errno
==
problem. If and error or deadlock occurs for one of the tokens,
all the tokens will be released and the method will return -1.
Note that returning on detection of deadlock prevents livelock
between competing collections. If a collection returns after
detecting deadlock, it is the application's responsibility to not
to blindly loop on the collection::acquire operation. In other
words, once the collection reports deadlock, it is out of our
hands.
virtual int acquire (const char *token_name, int notify = 0, void (*sleep_hook)(
void *) = 0,
ACE_Synch_Options &options = ACE_Synch_Options::defaults
);
token_name
. The other
parameters are passed to token
::acquire.
virtual int tryacquire (void (*sleep_hook)(void *) = 0);
virtual int tryacquire (const char *token_name, void (*sleep_hook)(
void *) = 0
);
token_name
.
virtual int renew (
int requeue_position = 0,
ACE_Synch_Options &options = ACE_Synch_Options::defaults
);
errno
==
problem.
virtual int renew (
const char *token_name,
int requeue_position = 0,
ACE_Synch_Options &options = ACE_Synch_Options::defaults
);
token_name
. The other
parameters are passed to token
::renew.
ACE_Synch_Options::defaults);
errno
==
problem.
virtual int release (
const char *token_name,
ACE_Synch_Options &options = ACE_Synch_Options::defaults
);
token_name
. The other
parameters are passed to token
::release.
~ACE_Token_Collection (void);
void dump (void) const;
virtual const char *name (void) const;
virtual ACE_Token_Proxy *clone (void) const;
virtual ACE_Tokens *create_token (const char *name);