From bb0bd254b0df35a1890ffb3f59e159945ccdf0bb Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Wed, 7 Jan 2009 10:46:53 +0000 Subject: QPID-1560: add support for a qpid.exclusive-binding option on direct exchange that causes the binding specified to be the only one for the given key. I.e. if there is already a binding at this exchange with this key it will be atomically updated to bind the new queue. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@732297 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/CopyOnWriteArray.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cpp/src/qpid/sys/CopyOnWriteArray.h') diff --git a/cpp/src/qpid/sys/CopyOnWriteArray.h b/cpp/src/qpid/sys/CopyOnWriteArray.h index c5bdcc0942..a09ee9d441 100644 --- a/cpp/src/qpid/sys/CopyOnWriteArray.h +++ b/cpp/src/qpid/sys/CopyOnWriteArray.h @@ -64,6 +64,18 @@ public: } } + bool clear() + { + Mutex::ScopedLock l(lock); + if (array && !array->empty()) { + ArrayPtr copy; + array = copy; + return true; + } else { + return false; + } + } + template bool add_unless(T& t, F f) { -- cgit v1.2.1