summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/DispatchHandle.h
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-01-06 23:42:18 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-01-06 23:42:18 +0000
commit9a933ae9011d343a75929136269fe45c6b863a17 (patch)
tree29ebd71241d810af6e0f20d7e5694cba1607486f /cpp/src/qpid/sys/DispatchHandle.h
parent820071d5a9959a2923269751ddcff2ed085b239a (diff)
downloadqpid-python-9a933ae9011d343a75929136269fe45c6b863a17.tar.gz
Work on the low level IO code:
* Introduce code so that you can interrupt waiting for a handle and receive a callback that is correctly serialised with the IO callbacks for that handle git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@732177 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/DispatchHandle.h')
-rw-r--r--cpp/src/qpid/sys/DispatchHandle.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/cpp/src/qpid/sys/DispatchHandle.h b/cpp/src/qpid/sys/DispatchHandle.h
index 219f2c53d6..ffcbd80f7e 100644
--- a/cpp/src/qpid/sys/DispatchHandle.h
+++ b/cpp/src/qpid/sys/DispatchHandle.h
@@ -27,6 +27,7 @@
#include <boost/function.hpp>
+#include <queue>
namespace qpid {
namespace sys {
@@ -53,11 +54,13 @@ class DispatchHandle : public PollerHandle {
friend class DispatchHandleRef;
public:
typedef boost::function1<void, DispatchHandle&> Callback;
+ typedef std::queue<Callback> CallbackQueue;
private:
Callback readableCallback;
Callback writableCallback;
Callback disconnectedCallback;
+ CallbackQueue interruptedCallbacks;
Poller::shared_ptr poller;
Mutex stateLock;
enum {
@@ -92,12 +95,12 @@ public:
/** Add this DispatchHandle to the poller to be watched. */
void startWatch(Poller::shared_ptr poller);
- /** Resume watchingn for all non-0 callbacks. */
+ /** Resume watching for all non-0 callbacks. */
void rewatch();
- /** Resume watchingn for read only. */
+ /** Resume watching for read only. */
void rewatchRead();
- /** Resume watchingn for write only. */
+ /** Resume watching for write only. */
void rewatchWrite();
/** Stop watching temporarily. The DispatchHandle remains
@@ -112,6 +115,11 @@ public:
/** Stop watching permanently. Disassociates from the poller. */
void stopWatch();
+ /** Interrupt watching this handle and make a serialised callback that respects the
+ * same exclusivity guarantees as the other callbacks
+ */
+ void call(Callback iCb);
+
protected:
/** Override to get extra processing done when the DispatchHandle is deleted. */
void doDelete();
@@ -139,6 +147,7 @@ public:
void unwatchRead() { ref->unwatchRead(); }
void unwatchWrite() { ref->unwatchWrite(); }
void stopWatch() { ref->stopWatch(); }
+ void call(Callback iCb) { ref->call(iCb); }
};
}}