From 3a46a28af02b11478a9da2af3cf557e11abbb210 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Mon, 3 Jun 2024 12:45:37 -0600 Subject: [PATCH] Call `uv_loop_fork` to redecorate the default loop after `fork()` --- src/App.cpp | 4 ++-- src/App_unix.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/App.cpp b/src/App.cpp index 39ec0d62..100d2483 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -61,13 +61,13 @@ int xmrig::App::exec() return 2; } - m_signals = std::make_shared(this); - int rc = 0; if (background(rc)) { return rc; } + m_signals = std::make_shared(this); + rc = m_controller->init(); if (rc != 0) { return rc; diff --git a/src/App_unix.cpp b/src/App_unix.cpp index b0b80079..3fde75d0 100644 --- a/src/App_unix.cpp +++ b/src/App_unix.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "App.h" @@ -53,6 +54,8 @@ bool xmrig::App::background(int &rc) return true; } + uv_loop_fork(uv_default_loop()); + i = setsid(); if (i < 0) {