Merge pull request #6630 from Icinga/bugfix/socket-events-init

Initialize Socket Event Engine on application startup
This commit is contained in:
Michael Friedrich 2018-09-25 11:57:35 +02:00 committed by GitHub
commit 4695e620d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -35,6 +35,8 @@ static SocketEventEngine *l_SocketIOEngine;
int SocketEvents::m_NextID = 0;
INITIALIZE_ONCE(&SocketEvents::InitializeEngine);
void SocketEventEngine::Start()
{
for (int tid = 0; tid < SOCKET_IOTHREADS; tid++) {
@ -114,8 +116,6 @@ 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);
}

View File

@ -53,6 +53,8 @@ public:
void *GetEnginePrivate() const;
void SetEnginePrivate(void *priv);
static void InitializeEngine();
protected:
SocketEvents(const Socket::Ptr& socket, Object *lifesupportObject);
@ -64,8 +66,6 @@ private:
static int m_NextID;
static void InitializeEngine();
void WakeUpThread(bool wait = false);
void Register(Object *lifesupportObject);