diff options
author | Gordon Sim <gsim@apache.org> | 2007-11-29 11:54:17 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2007-11-29 11:54:17 +0000 |
commit | 6b179639ac573be8f5c7d84bfd480c71a6815265 (patch) | |
tree | 29d56665e8258c923f256fbed3942148dede48e0 /cpp/src/qpid/broker/SessionState.cpp | |
parent | d1f32f54b73807b778eb6027bb048f9e7b0e808f (diff) | |
download | qpid-python-6b179639ac573be8f5c7d84bfd480c71a6815265.tar.gz |
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
Diffstat (limited to 'cpp/src/qpid/broker/SessionState.cpp')
-rw-r--r-- | cpp/src/qpid/broker/SessionState.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/SessionState.cpp b/cpp/src/qpid/broker/SessionState.cpp index 27658f2c84..bea1eaedcf 100644 --- a/cpp/src/qpid/broker/SessionState.cpp +++ b/cpp/src/qpid/broker/SessionState.cpp @@ -30,6 +30,7 @@ namespace qpid { namespace broker { using namespace framing; +using sys::Mutex; void SessionState::handleIn(AMQFrame& f) { semanticHandler->handle(f); } @@ -48,7 +49,8 @@ SessionState::SessionState( { // TODO aconway 2007-09-20: SessionManager may add plugin // handlers to the chain. - } + getConnection().outputTasks.addOutputTask(&semanticHandler->getSemanticState()); +} SessionState::~SessionState() { // Remove ID from active session list. @@ -70,11 +72,28 @@ Connection& SessionState::getConnection() { } void SessionState::detach() { + getConnection().outputTasks.removeOutputTask(&semanticHandler->getSemanticState()); + Mutex::ScopedLock l(lock); handler = 0; } void SessionState::attach(SessionHandler& h) { - handler = &h; + { + Mutex::ScopedLock l(lock); + handler = &h; + } + h.getConnection().outputTasks.addOutputTask(&semanticHandler->getSemanticState()); +} + +void SessionState::activateOutput() +{ + Mutex::ScopedLock l(lock); + if (isAttached()) { + getConnection().outputTasks.activateOutput(); + } } + //This class could be used as the callback for queue notifications + //if not attached, it can simply ignore the callback, else pass it + //on to the connection }} // namespace qpid::broker |