From 248f1fe188fe2307b9dcf2c87a83b653eaa1920c Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Sat, 26 Dec 2009 12:42:57 +0000 Subject: 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 --- cpp/src/qpid/client/StateManager.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/client/StateManager.cpp') 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); -- cgit v1.2.1