diff options
author | Ted Ross <tross@apache.org> | 2011-09-13 19:34:38 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2011-09-13 19:34:38 +0000 |
commit | 5b4907d81effd26d15dd418ff2a3df8bb3dab9e3 (patch) | |
tree | b94ebca24ca0c8217ac60769ca73c27a694edee9 /qpid/cpp/src/qmf/ConsoleSession.cpp | |
parent | 7666ee8f50ba9554e71142290fcc58c2e1ad46e9 (diff) | |
download | qpid-python-5b4907d81effd26d15dd418ff2a3df8bb3dab9e3.tar.gz |
QPID-3484 - QMF Main-Loop Integration
Applied patch from Darryl Pierce.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1170314 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qmf/ConsoleSession.cpp')
-rw-r--r-- | qpid/cpp/src/qmf/ConsoleSession.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/qpid/cpp/src/qmf/ConsoleSession.cpp b/qpid/cpp/src/qmf/ConsoleSession.cpp index af835959cf..d084b8a8eb 100644 --- a/qpid/cpp/src/qmf/ConsoleSession.cpp +++ b/qpid/cpp/src/qmf/ConsoleSession.cpp @@ -237,6 +237,8 @@ bool ConsoleSessionImpl::nextEvent(ConsoleEvent& event, Duration timeout) if (!eventQueue.empty()) { event = eventQueue.front(); eventQueue.pop(); + if (eventQueue.empty()) + alertEventNotifierLH(false); return true; } @@ -251,6 +253,20 @@ int ConsoleSessionImpl::pendingEvents() const } +void ConsoleSessionImpl::setEventNotifier(EventNotifierImpl* notifier) +{ + qpid::sys::Mutex::ScopedLock l(lock); + this->eventNotifier = notifier; +} + + +EventNotifierImpl* ConsoleSessionImpl::getEventNotifier() const +{ + qpid::sys::Mutex::ScopedLock l(lock); + return this->eventNotifier; +} + + uint32_t ConsoleSessionImpl::getAgentCount() const { qpid::sys::Mutex::ScopedLock l(lock); @@ -292,8 +308,10 @@ void ConsoleSessionImpl::enqueueEventLH(const ConsoleEvent& event) { bool notify = eventQueue.empty(); eventQueue.push(event); - if (notify) + if (notify) { cond.notify(); + alertEventNotifierLH(true); + } } @@ -602,6 +620,13 @@ void ConsoleSessionImpl::periodicProcessing(uint64_t seconds) } +void ConsoleSessionImpl::alertEventNotifierLH(bool readable) +{ + if (eventNotifier) + eventNotifier->setReadable(readable); +} + + void ConsoleSessionImpl::run() { QPID_LOG(debug, "ConsoleSession thread started"); @@ -633,3 +658,14 @@ void ConsoleSessionImpl::run() QPID_LOG(debug, "ConsoleSession thread exiting"); } + +ConsoleSessionImpl& ConsoleSessionImplAccess::get(ConsoleSession& session) +{ + return *session.impl; +} + + +const ConsoleSessionImpl& ConsoleSessionImplAccess::get(const ConsoleSession& session) +{ + return *session.impl; +} |