diff options
Diffstat (limited to 'cpp/src/qpid/sys/rdma')
| -rw-r--r-- | cpp/src/qpid/sys/rdma/RdmaIO.cpp | 14 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/rdma/RdmaIO.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp index 068e8cf187..c89e0f2126 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -114,6 +114,20 @@ namespace Rdma { nc(*this); } + namespace { + void requestedCall(AsynchIO* aio, AsynchIO::RequestCallback callback) { + assert(callback); + callback(*aio); + } + } + + 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); + dataHandle.call(boost::bind(&requestedCall, this, callback)); + } + // Mark writing closed (so we don't accept any more writes or make any idle callbacks) void AsynchIO::drainWriteQueue(NotifyCallback nc) { State oldState; diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.h b/cpp/src/qpid/sys/rdma/RdmaIO.h index 8d5dbc5f3e..72cbac154b 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.h +++ b/cpp/src/qpid/sys/rdma/RdmaIO.h @@ -65,6 +65,8 @@ namespace Rdma { NotifyCallback notifyCallback; public: + typedef boost::function1<void, AsynchIO&> RequestCallback; + // TODO: Instead of specifying a buffer size specify the amount of memory the AsynchIO class can use // for buffers both read and write (allocate half to each up front) and fail if we cannot allocate that much // locked memory @@ -87,6 +89,7 @@ namespace Rdma { void notifyPendingWrite(); void drainWriteQueue(NotifyCallback); void stop(NotifyCallback); + void requestCallback(RequestCallback); int incompletedWrites() const; Buffer* getBuffer(); void returnBuffer(Buffer*); |
