From 32546e22828e793e3881e1055acb72b6a044e331 Mon Sep 17 00:00:00 2001 From: Rat Date: Mon, 7 Jun 2010 19:10:55 +0200 Subject: added ace + vcproj for win --HG-- branch : trunk --- externals/ace/Test_and_Set.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 externals/ace/Test_and_Set.cpp (limited to 'externals/ace/Test_and_Set.cpp') diff --git a/externals/ace/Test_and_Set.cpp b/externals/ace/Test_and_Set.cpp new file mode 100644 index 00000000000..15fbfe084f5 --- /dev/null +++ b/externals/ace/Test_and_Set.cpp @@ -0,0 +1,51 @@ +// $Id: Test_and_Set.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TEST_AND_SET_CPP +#define ACE_TEST_AND_SET_CPP + +#include "ace/Test_and_Set.h" +#include "ace/Guard_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Test_and_Set::ACE_Test_and_Set (TYPE initial_value) + : is_set_ (initial_value) +{ +} + +// Returns true if we are done, else false. +template TYPE +ACE_Test_and_Set::is_set (void) const +{ + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, this->is_set_); + return this->is_set_; +} + +// Sets the status. +template TYPE +ACE_Test_and_Set::set (TYPE status) +{ + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, this->is_set_); + TYPE o_status = this->is_set_; + this->is_set_ = status; + return o_status; +} + +template int +ACE_Test_and_Set::handle_signal (int, siginfo_t *, ucontext_t *) +{ + // By setting this to 1, we are "signaling" to anyone calling + // or or that the "test and set" object is in the + // "signaled" state, i.e., it's "available" to be set back to 0. + this->set (1); + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TEST_AND_SET_CPP */ -- cgit v1.2.3