Revert to Current Include Style
[ACE_TAO.git] / ACE / ace / Test_and_Set.cpp
blob4c089b6b0fc7340313b7581436264027556d54e2
1 #ifndef ACE_TEST_AND_SET_CPP
2 #define ACE_TEST_AND_SET_CPP
4 #include "ace/Test_and_Set.h"
5 #include "ace/Guard_T.h"
7 #if !defined (ACE_LACKS_PRAGMA_ONCE)
8 # pragma once
9 #endif /* ACE_LACKS_PRAGMA_ONCE */
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 template <class ACE_LOCK, class TYPE>
14 ACE_Test_and_Set<ACE_LOCK, TYPE>::ACE_Test_and_Set (TYPE initial_value)
15 : is_set_ (initial_value)
19 // Returns true if we are done, else false.
20 template <class ACE_LOCK, class TYPE> TYPE
21 ACE_Test_and_Set<ACE_LOCK, TYPE>::is_set () const
23 ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, this->is_set_);
24 return this->is_set_;
27 // Sets the <is_set_> status.
28 template <class ACE_LOCK, class TYPE> TYPE
29 ACE_Test_and_Set<ACE_LOCK, TYPE>::set (TYPE status)
31 ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, this->is_set_);
32 TYPE o_status = this->is_set_;
33 this->is_set_ = status;
34 return o_status;
37 template <class ACE_LOCK, class TYPE> int
38 ACE_Test_and_Set<ACE_LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *)
40 // By setting this to 1, we are "signaling" to anyone calling
41 // <is_set> or or <set> that the "test and set" object is in the
42 // "signaled" state, i.e., it's "available" to be set back to 0.
43 this->set (1);
44 return 0;
47 ACE_END_VERSIONED_NAMESPACE_DECL
49 #endif /* ACE_TEST_AND_SET_CPP */