From 523c7d10c922fc442f1e0efe6cf91491ff257647 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Mon, 22 Mar 2010 03:57:52 +0000 Subject: Make sure the client library Poller is created on library load before anything in the client program can be run. This ensures that it will be destroyed after anything in the client program is destroyed git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@925949 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ConnectionImpl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cpp/src') diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp index cb9df8e60f..ec1f4584db 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -134,6 +134,15 @@ 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; -- cgit v1.2.1