summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-01-27 21:17:47 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-01-27 21:17:47 +0000
commit2dff9493ceb62d37a3b70a4abd6bc0539bdb581e (patch)
tree0003c4766da8f32e8fc2b9f5b4968391b7319492 /cpp/src/qpid/sys
parent3f547381f1af5cdb9d7c5f9cc30f7303d643afd9 (diff)
downloadqpid-python-2dff9493ceb62d37a3b70a4abd6bc0539bdb581e.tar.gz
Producer side rate throttling:
This uses the Message.Flow command to send credit from broker to client to ensure that the client doesn't exceed a rate configured on the broker per session. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@738247 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys')
-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: