diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2009-12-26 12:42:57 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2009-12-26 12:42:57 +0000 |
| commit | 248f1fe188fe2307b9dcf2c87a83b653eaa1920c (patch) | |
| tree | d5d0959a70218946ff72e107a6c106e32479a398 /cpp/src/qpid/client/StateManager.cpp | |
| parent | 3c83a0e3ec7cf4dc23e83a340b25f5fc1676f937 (diff) | |
| download | qpid-python-248f1fe188fe2307b9dcf2c87a83b653eaa1920c.tar.gz | |
synchronized with trunk except for ruby dir
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid.rnr@893970 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/StateManager.cpp')
| -rw-r--r-- | cpp/src/qpid/client/StateManager.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cpp/src/qpid/client/StateManager.cpp b/cpp/src/qpid/client/StateManager.cpp index 0cb3c6b9d4..5462e0fed4 100644 --- a/cpp/src/qpid/client/StateManager.cpp +++ b/cpp/src/qpid/client/StateManager.cpp @@ -19,7 +19,7 @@ * */ -#include "StateManager.h" +#include "qpid/client/StateManager.h" #include "qpid/framing/amqp_framing.h" using namespace qpid::client; @@ -60,6 +60,18 @@ void StateManager::setState(int s) stateLock.notifyAll(); } +bool StateManager::setState(int s, int expected) +{ + Monitor::ScopedLock l(stateLock); + if (state == expected) { + state = s; + stateLock.notifyAll(); + return true; + } else { + return false; + } +} + int StateManager::getState() const { Monitor::ScopedLock l(stateLock); |
