diff options
| author | Gordon Sim <gsim@apache.org> | 2009-01-07 10:46:53 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2009-01-07 10:46:53 +0000 |
| commit | bb0bd254b0df35a1890ffb3f59e159945ccdf0bb (patch) | |
| tree | ce0cd6a64409473e3c3c156bc825d02f5cbc1fb7 /cpp/src/qpid/sys/CopyOnWriteArray.h | |
| parent | e76832c5d237446129ad90232ea8ef5c61fe18db (diff) | |
| download | qpid-python-bb0bd254b0df35a1890ffb3f59e159945ccdf0bb.tar.gz | |
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
Diffstat (limited to 'cpp/src/qpid/sys/CopyOnWriteArray.h')
| -rw-r--r-- | cpp/src/qpid/sys/CopyOnWriteArray.h | 12 |
1 files changed, 12 insertions, 0 deletions
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 <class F> bool add_unless(T& t, F f) { |
