diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2024-03-25 16:32:32 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@gmail.com> | 2024-03-26 20:16:08 +0000 |
commit | 40f4977792713c43532be4ae7fdf525ac2424e9c (patch) | |
tree | 96c3ec2e653656977370e782bec797bbb34e64a2 /kit | |
parent | calc: fixed bogus cell view cursor overlay (diff) | |
download | online-40f4977792713c43532be4ae7fdf525ac2424e9c.tar.gz online-40f4977792713c43532be4ae7fdf525ac2424e9c.zip |
forkit: quicker zombie reaping by handling SIGCHLD.
Should launch new children more quickly on child death,
as well as getting to a waitpid and cleaning the zombies
faster too.
Change-Id: I06c36f63ac7ff52c407f739f1ce10d5e680fb82f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'kit')
-rw-r--r-- | kit/ForKit.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp index f96eb94d1c..069da7a3e9 100644 --- a/kit/ForKit.cpp +++ b/kit/ForKit.cpp @@ -435,6 +435,8 @@ static int createLibreOfficeKit(const std::string& childRoot, ForKitPoll->closeAllSockets(); // else very first kit process spawned + SigUtil::setSigChildHandler(nullptr); + UnitKit::get().postFork(); sleepForDebugger(); @@ -499,6 +501,14 @@ static void printArgumentHelp() std::cout << "" << std::endl; } +extern "C" { + static void wakeupPoll(uint32_t /*pid*/) + { + if (ForKitPoll) + ForKitPoll->wakeup(); + } +} + int forkit_main(int argc, char** argv) { /*WARNING: PRIVILEGED CODE CHECKING START */ @@ -781,6 +791,9 @@ int forkit_main(int argc, char** argv) ForKitPoll.reset(new SocketPoll (Util::getThreadName())); ForKitPoll->runOnClientThread(); // We will do the polling on this thread. + // Reap zombies when we get the signal + SigUtil::setSigChildHandler(wakeupPoll); + WSHandler = std::make_shared<ServerWSHandler>("forkit_ws"); if (!Util::isMobileApp() && |