From 4e485d80018badb68d18cfb20886dd97f18ae7b1 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 8 Apr 2010 04:53:26 +0000 Subject: Improved fix for to create client library Poller. Improved because it is now created at first need rather than library load. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@931781 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ConnectionImpl.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'cpp/src/qpid/client/ConnectionImpl.cpp') diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp index 05a781c2d9..b6043518e8 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -137,15 +137,6 @@ IOThread& theIO() { return io; } -// Bring theIO into existence on library load rather than first use. -// This avoids it being destroyed whilst something in the main program -// still exists -struct InitAtLoad { - InitAtLoad() { - (void) theIO(); - } -} init; - class HeartbeatTask : public TimerTask { TimeoutHandler& timeout; @@ -164,6 +155,13 @@ public: } +// Ensure the IO threads exist: +// This needs to be called in the Connection constructor +// so that they will still exist at last connection destruction +void ConnectionImpl::init() { + (void) theIO(); +} + ConnectionImpl::ConnectionImpl(framing::ProtocolVersion v, const ConnectionSettings& settings) : Bounds(settings.maxFrameSize * settings.bounds), handler(settings, v), -- cgit v1.2.1