Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Test_and_Set.cpp

Go to the documentation of this file.
00001 // $Id: Test_and_Set.cpp,v 1.1.1.1 2001/12/04 14:33:10 chad Exp $
00002 
00003 #ifndef ACE_TEST_AND_SET_C
00004 #define ACE_TEST_AND_SET_C
00005 
00006 #include "ace/Test_and_Set.h"
00007 #include "ace/Synch_T.h"
00008 
00009 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00010 # pragma once
00011 #endif /* ACE_LACKS_PRAGMA_ONCE */
00012 
00013 ACE_RCSID(ace, Test_and_Set, "$Id: Test_and_Set.cpp,v 1.1.1.1 2001/12/04 14:33:10 chad Exp $")
00014 
00015 template <class ACE_LOCK, class TYPE>
00016 ACE_Test_and_Set<ACE_LOCK, TYPE>::ACE_Test_and_Set (TYPE initial_value)
00017   : is_set_ (initial_value)
00018 {
00019 }
00020 
00021 // Returns true if we are done, else false.
00022 template <class ACE_LOCK, class TYPE> TYPE
00023 ACE_Test_and_Set<ACE_LOCK, TYPE>::is_set (void) const
00024 {
00025   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, this->is_set_);
00026   return this->is_set_;
00027 }
00028 
00029 // Sets the <is_set_> status.
00030 template <class ACE_LOCK, class TYPE> TYPE
00031 ACE_Test_and_Set<ACE_LOCK, TYPE>::set (TYPE status)
00032 {
00033   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, this->is_set_);
00034   TYPE o_status = this->is_set_;
00035   this->is_set_ = status;
00036   return o_status;
00037 }
00038 
00039 template <class ACE_LOCK, class TYPE> int
00040 ACE_Test_and_Set<ACE_LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *)
00041 {
00042   // By setting this to 1, we are "signaling" to anyone calling
00043   // <is_set> or or <set> that the "test and set" object is in the
00044   // "signaled" state, i.e., it's "available" to be set back to 0.
00045   this->set (1);
00046   return 0;
00047 }
00048 
00049 #endif /* ACE_TEST_AND_SET_C */

Generated on Mon Jun 16 11:21:44 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002