From 6b179639ac573be8f5c7d84bfd480c71a6815265 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 29 Nov 2007 11:54:17 +0000 Subject: Changes to threading: queues serialiser removed, io threads used to drive dispatch to consumers Fix to PersistableMessage: use correct lock when accessing synclist, don't hold enqueue lock when notifying queues git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@599395 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/AsynchIOAcceptor.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'cpp/src/qpid/sys/AsynchIOAcceptor.cpp') diff --git a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp index bdf3e3b8d3..51ec7f718a 100644 --- a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp +++ b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp @@ -115,6 +115,7 @@ public: // Output side void send(framing::AMQFrame&); void close(); + void activateOutput(); // Input side void readbuff(AsynchIO& aio, AsynchIO::BufferBase* buff); @@ -135,7 +136,7 @@ void AsynchIOAcceptor::accepted(Poller::shared_ptr poller, const Socket& s, Conn boost::bind(&AsynchIOHandler::readbuff, async, _1, _2), boost::bind(&AsynchIOHandler::eof, async, _1), boost::bind(&AsynchIOHandler::disconnect, async, _1), - boost::bind(&AsynchIOHandler::closedSocket, async, _1, _2), + boost::bind(&AsynchIOHandler::closedSocket, async, _1, _2), boost::bind(&AsynchIOHandler::nobuffs, async, _1), boost::bind(&AsynchIOHandler::idle, async, _1)); async->init(aio, handler); @@ -195,7 +196,7 @@ void AsynchIOHandler::send(framing::AMQFrame& frame) { } // Activate aio for writing here - aio->queueWrite(); + aio->notifyPendingWrite(); } void AsynchIOHandler::close() { @@ -203,6 +204,10 @@ void AsynchIOHandler::close() { frameQueueClosed = true; } +void AsynchIOHandler::activateOutput() { + aio->notifyPendingWrite(); +} + // Input side void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { if (readError) { @@ -272,9 +277,11 @@ void AsynchIOHandler::idle(AsynchIO&){ ScopedLock l(frameQueueLock); if (frameQueue.empty()) { - // At this point we know that we're write idling the connection - // so we could note that somewhere or do something special - return; + // At this point we know that we're write idling the connection + // so tell the input handler to queue any available output: + inputHandler->doOutput(); + //if still no frames, theres nothing to do: + if (frameQueue.empty()) return; } do { -- cgit v1.2.1