From 79a29f32ef84c26de35d3e75c3acff314b727f56 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Wed, 13 Jan 2010 11:57:19 +0000 Subject: Added raise_event support to the Ruby and Python wrapped agent APIs. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@898727 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qmf/engine/ResilientConnection.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'cpp/src/qmf/engine/ResilientConnection.cpp') diff --git a/cpp/src/qmf/engine/ResilientConnection.cpp b/cpp/src/qmf/engine/ResilientConnection.cpp index 53524fdbd8..9c19e4d460 100644 --- a/cpp/src/qmf/engine/ResilientConnection.cpp +++ b/cpp/src/qmf/engine/ResilientConnection.cpp @@ -39,6 +39,8 @@ #include #include #include +#include +#include using namespace std; using namespace qmf::engine; @@ -330,6 +332,10 @@ void ResilientConnectionImpl::unbind(SessionHandle handle, void ResilientConnectionImpl::setNotifyFd(int fd) { notifyFd = fd; + if (notifyFd > 0) { + int original = fcntl(notifyFd, F_GETFL); + fcntl(notifyFd, F_SETFL, O_NONBLOCK | original); + } } void ResilientConnectionImpl::run() @@ -403,13 +409,16 @@ void ResilientConnectionImpl::EnqueueEvent(ResilientConnectionEvent::EventKind k const MessageImpl& message, const string& errorText) { - Mutex::ScopedLock _lock(lock); - ResilientConnectionEventImpl event(kind, message); + { + Mutex::ScopedLock _lock(lock); + ResilientConnectionEventImpl event(kind, message); - event.sessionContext = sessionContext; - event.errorText = errorText; + event.sessionContext = sessionContext; + event.errorText = errorText; + + eventQueue.push_back(event); + } - eventQueue.push_back(event); if (notifyFd != -1) { int unused_ret; //Suppress warnings about ignoring return value. -- cgit v1.2.1