summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/AsynchIO.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys/AsynchIO.h')
-rw-r--r--cpp/src/qpid/sys/AsynchIO.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/AsynchIO.h b/cpp/src/qpid/sys/AsynchIO.h
index 7cb56b30aa..ca34d82741 100644
--- a/cpp/src/qpid/sys/AsynchIO.h
+++ b/cpp/src/qpid/sys/AsynchIO.h
@@ -97,6 +97,13 @@ private:
std::deque<BufferBase*> bufferQueue;
std::deque<BufferBase*> writeQueue;
bool queuedClose;
+ /**
+ * This flag is used to detect and handle concurrency between
+ * calls to notifyPendingWrite() (which can be made from any thread) and
+ * the execution of the writeable() method (which is always on the
+ * thread processing this handle.
+ */
+ volatile bool writePending;
public:
AsynchIO(const Socket& s,
@@ -107,7 +114,8 @@ public:
void start(Poller::shared_ptr poller);
void queueReadBuffer(BufferBase* buff);
void unread(BufferBase* buff);
- void queueWrite(BufferBase* buff = 0);
+ void queueWrite(BufferBase* buff);
+ void notifyPendingWrite();
void queueWriteClose();
bool writeQueueEmpty() { return writeQueue.empty(); }
BufferBase* getQueuedBuffer();