ACE
6.1.0
|
Implements the classic ``test and set'' operation. More...
#include <Test_and_Set.h>
Public Member Functions | |
ACE_Test_and_Set (TYPE initial_value=0) | |
TYPE | is_set (void) const |
Returns true if we are set, else false. | |
TYPE | set (TYPE) |
virtual int | handle_signal (int signum, siginfo_t *=0, ucontext_t *=0) |
Private Attributes | |
TYPE | is_set_ |
Keeps track of our state. | |
ACE_LOCK | lock_ |
Protect the state from race conditions. |
Implements the classic ``test and set'' operation.
This class keeps track of the status of <is_set_>, which can be set based on various events (such as receipt of a signal). This class is derived from ACE_Event_Handler so that it can be "signaled" by a Reactor when a signal occurs. We assume that <TYPE> is a data type that can be assigned the value 0 or 1.
ACE_Test_and_Set< ACE_LOCK, TYPE >::ACE_Test_and_Set | ( | TYPE | initial_value = 0 | ) |
int ACE_Test_and_Set< ACE_LOCK, TYPE >::handle_signal | ( | int | signum, |
siginfo_t * | = 0 , |
||
ucontext_t * | = 0 |
||
) | [virtual] |
Called when object is signaled by OS (either via UNIX signals or when a Win32 object becomes signaled).
Reimplemented from ACE_Event_Handler.
TYPE ACE_Test_and_Set< ACE_LOCK, TYPE >::is_set | ( | void | ) | const |
Returns true if we are set, else false.
TYPE ACE_Test_and_Set< ACE_LOCK, TYPE >::set | ( | TYPE | status | ) |
Sets the <is_set_> status, returning the original value of <is_set_>.
TYPE ACE_Test_and_Set< ACE_LOCK, TYPE >::is_set_ [private] |
Keeps track of our state.
ACE_LOCK ACE_Test_and_Set< ACE_LOCK, TYPE >::lock_ [private] |
Protect the state from race conditions.