1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +00:00

LibCore: Add 'notify_forked()' to tear down the eventloop in forked child

This makes the forked process capable of constructing a new event loop,
should it choose to.
This commit is contained in:
AnotherTest 2020-09-07 22:44:42 +04:30 committed by Andreas Kling
parent aa2df9277d
commit c3dbe77024
2 changed files with 28 additions and 1 deletions

View file

@ -81,6 +81,13 @@ public:
static int register_signal(int signo, Function<void(int)> handler);
static void unregister_signal(int handler_id);
// Note: Boost uses Parent/Child/Prepare, but we don't really have anything
// interesting to do in the parent or before forking.
enum class ForkEvent {
Child,
};
static void notify_forked(ForkEvent);
private:
bool start_rpc_server();
void wait_for_event(WaitMode);
@ -102,8 +109,8 @@ private:
class SignalHandlers {
AK_MAKE_NONCOPYABLE(SignalHandlers);
public:
public:
SignalHandlers(SignalHandlers&& from)
: m_signo(from.m_signo)
, m_original_handler(from.m_original_handler)