summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/Semaphore.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys/Semaphore.h')
-rw-r--r--cpp/src/qpid/sys/Semaphore.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/Semaphore.h b/cpp/src/qpid/sys/Semaphore.h
index 3efb7ce2df..af937b60b8 100644
--- a/cpp/src/qpid/sys/Semaphore.h
+++ b/cpp/src/qpid/sys/Semaphore.h
@@ -51,10 +51,22 @@ public:
count--;
}
+ void release(uint n)
+ {
+ Monitor::ScopedLock l(monitor);
+ if (count==0) monitor.notifyAll();
+ count+=n;
+ }
+
void release()
{
+ release(1);
+ }
+
+ void forceLock()
+ {
Monitor::ScopedLock l(monitor);
- if (!count++) monitor.notifyAll();
+ count = 0;
}
private: