summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/posix/AsynchIO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys/posix/AsynchIO.cpp')
-rw-r--r--cpp/src/qpid/sys/posix/AsynchIO.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp
index 9a5798311b..b4fede06fd 100644
--- a/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp
@@ -266,6 +266,7 @@ public:
virtual void queueWriteClose();
virtual bool writeQueueEmpty();
virtual void startReading();
+ virtual void requestCallback(RequestCallback);
virtual BufferBase* getQueuedBuffer();
private:
@@ -275,6 +276,7 @@ private:
void readable(DispatchHandle& handle);
void writeable(DispatchHandle& handle);
void disconnected(DispatchHandle& handle);
+ void requestedCall(RequestCallback);
void close(DispatchHandle& handle);
private:
@@ -386,6 +388,18 @@ void AsynchIO::startReading() {
DispatchHandle::rewatchRead();
}
+void AsynchIO::requestCallback(RequestCallback callback) {
+ // TODO creating a function object every time isn't all that
+ // efficient - if this becomes heavily used do something better (what?)
+ assert(callback);
+ DispatchHandle::call(boost::bind(&AsynchIO::requestedCall, this, callback));
+}
+
+void AsynchIO::requestedCall(RequestCallback callback) {
+ assert(callback);
+ callback(*this);
+}
+
/** Return a queued buffer if there are enough
* to spare
*/