NAME
ACE_Test_and_Set -
Implements the classic ``test and set'' operation.
SYNOPSIS
#include <ace/Synch_T.h>
template<class LOCK, class TYPE>
class ACE_Test_and_Set : public ACE_Event_Handler
{
public:
ACE_Test_and_Set (TYPE initial_value = 0);
TYPE is_set (void) const;
TYPE set (TYPE);
virtual int handle_signal (
int signum,
siginfo_t * = 0,
ucontext_t * = 0
);
private:
TYPE is_set_;
LOCK lock_;
};
DESCRIPTION
This class keeps track of the status of is_set_, which can
be set based on various events (such as receipt of a signal).
PUBLIC MEMBERS
ACE_Test_and_Set (TYPE initial_value = 0);
TYPE is_set (void) const;
Returns true if we are set, else false.
TYPE set (TYPE);
Sets the set_ status, returning
virtual int handle_signal (
int signum,
siginfo_t * = 0,
ucontext_t * = 0
);
Called when object is signaled by OS (either via UNIX signals or
when a Win32 object becomes signaled).
PRIVATE MEMBERS
TYPE is_set_;
Keeps track of our state.
LOCK lock_;
AUTHOR
Doug Schmidt
LIBRARY
ace