00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #ifndef ACE_TEST_AND_SET_H
00013 #define ACE_TEST_AND_SET_H
00014 
00015 #include  "ace/pre.h"
00016 #include "ace/Event_Handler.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 # pragma once
00020 #endif 
00021 
00022 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 template <class ACE_LOCK, class TYPE>
00038 class ACE_Test_and_Set : public ACE_Event_Handler
00039 {
00040 public:
00041   ACE_Test_and_Set (TYPE initial_value = 0);
00042 
00043 
00044   TYPE is_set (void) const;
00045 
00046 
00047 
00048   TYPE set (TYPE);
00049 
00050 
00051 
00052   virtual int handle_signal (int signum,
00053                              siginfo_t * = 0,
00054                              ucontext_t * = 0);
00055 
00056 private:
00057 
00058   TYPE is_set_;
00059 
00060 
00061   ACE_LOCK lock_;
00062 };
00063 
00064 ACE_END_VERSIONED_NAMESPACE_DECL
00065 
00066 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00067 #include "ace/Test_and_Set.cpp"
00068 #endif 
00069 
00070 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00071 #pragma implementation ("Test_and_Set.cpp")
00072 #endif 
00073 
00074 #include  "ace/post.h"
00075 #endif