diff options
Diffstat (limited to 'ace/Test_and_Set.h')
-rw-r--r-- | ace/Test_and_Set.h | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/ace/Test_and_Set.h b/ace/Test_and_Set.h index 27964034855..83bb57e329d 100644 --- a/ace/Test_and_Set.h +++ b/ace/Test_and_Set.h @@ -1,4 +1,14 @@ -// $Id$ + +//============================================================================= +/** + * @file Test_and_Set.h + * + * $Id$ + * + * @author Priyanka Gontla <pgontla@ece.uci.edu> + */ +//============================================================================= + #ifndef ACE_TEST_AND_SET_H #define ACE_TEST_AND_SET_H @@ -10,41 +20,44 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +/** + * @class ACE_Test_and_Set + * + * @brief 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. + */ template <class ACE_LOCK, class TYPE> class ACE_Export ACE_Test_and_Set : public ACE_Event_Handler { public: - // = TITLE - // Implements the classic ``test and set'' operation. - // - // = 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). 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 (TYPE initial_value = 0); + /// Returns true if we are set, else false. TYPE is_set (void) const; - // Returns true if we are set, else false. + /// Sets the <is_set_> status, returning the original value of + /// <is_set_>. TYPE set (TYPE); - // Sets the <is_set_> status, returning the original value of - // <is_set_>. + /// Called when object is signaled by OS (either via UNIX signals or + /// when a Win32 object becomes signaled). 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: + /// Keeps track of our state. TYPE is_set_; - // Keeps track of our state. + /// Protect the state from race conditions. ACE_LOCK lock_; - // Protect the state from race conditions. }; #if defined (__ACE_INLINE__) |