From 4be9f418a9ae6626921dbd213a7d54953cf3aef6 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 9 Oct 2018 19:38:29 +0200 Subject: [PATCH] Revert "Initialize Socket Event Engine on application startup" This reverts commit c8dcd1297f6d0be8685c5a3079e40fc44e779add. We cannot do this during application startup, since Daemonize() kills the threads again. refs #6514 refs #6630 --- lib/base/socketevents.cpp | 4 ++-- lib/base/socketevents.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/base/socketevents.cpp b/lib/base/socketevents.cpp index 0e2be5017..b967a345f 100644 --- a/lib/base/socketevents.cpp +++ b/lib/base/socketevents.cpp @@ -35,8 +35,6 @@ static SocketEventEngine *l_SocketIOEngine; int SocketEvents::m_NextID = 0; -INITIALIZE_ONCE(&SocketEvents::InitializeEngine); - void SocketEventEngine::Start() { for (int tid = 0; tid < SOCKET_IOTHREADS; tid++) { @@ -116,6 +114,8 @@ void SocketEvents::InitializeEngine() SocketEvents::SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject) : m_ID(m_NextID++), m_FD(socket->GetFD()), m_EnginePrivate(nullptr) { + boost::call_once(l_SocketIOOnceFlag, &SocketEvents::InitializeEngine); + Register(lifesupportObject); } diff --git a/lib/base/socketevents.hpp b/lib/base/socketevents.hpp index fce7eef86..360a03477 100644 --- a/lib/base/socketevents.hpp +++ b/lib/base/socketevents.hpp @@ -53,8 +53,6 @@ public: void *GetEnginePrivate() const; void SetEnginePrivate(void *priv); - static void InitializeEngine(); - protected: SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject); @@ -66,6 +64,8 @@ private: static int m_NextID; + static void InitializeEngine(); + void WakeUpThread(bool wait = false); void Register(Object *lifesupportObject); -- 2.40.0