diff options
author | Andrew Stitcher <astitcher@apache.org> | 2008-04-18 21:03:49 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2008-04-18 21:03:49 +0000 |
commit | df28afb19a10c804cd02696bd94b09fed1719478 (patch) | |
tree | 9aafbc5ee664b561257cebe8edd2c46955b0999d /cpp/src/qpid/Plugin.cpp | |
parent | 8633240562fad63a493b319d12b9c663ca081c75 (diff) | |
download | qpid-python-df28afb19a10c804cd02696bd94b09fed1719478.tar.gz |
Refactored Acceptor code to allow multiple acceptors to be present in the broker
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@649689 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/Plugin.cpp')
-rw-r--r-- | cpp/src/qpid/Plugin.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/cpp/src/qpid/Plugin.cpp b/cpp/src/qpid/Plugin.cpp index d38b53a56e..77627c3742 100644 --- a/cpp/src/qpid/Plugin.cpp +++ b/cpp/src/qpid/Plugin.cpp @@ -22,11 +22,20 @@ namespace qpid { -Plugin::Plugins Plugin::plugins; +namespace { +// This is a single threaded singleton implementation so +// it is important to be sure that the first use of this +// singleton is when the program is still single threaded +Plugin::Plugins& thePlugins() { + static Plugin::Plugins plugins; + + return plugins; +} +} Plugin::Plugin() { // Register myself. - plugins.push_back(this); + thePlugins().push_back(this); } Plugin::~Plugin() {} @@ -34,7 +43,7 @@ Plugin::~Plugin() {} Options* Plugin::getOptions() { return 0; } const Plugin::Plugins& Plugin::getPlugins() { - return plugins; + return thePlugins(); } } // namespace qpid |