Added signal handler

This commit is contained in:
Joop Schilder 2019-01-16 17:24:06 +01:00
parent c0f4382cc9
commit ca094df37e
1 changed files with 12 additions and 0 deletions

View File

@ -235,6 +235,18 @@ class Asynchronous
self::removedShmBlock();
});
/*
* The signal handler
*/
foreach([SIGINT, SIGTERM, SIGUSR1] as $signal)
pcntl_signal($signal, function($s) use (&$instance) {
if ($instance->isChild)
return;
self::killChildren();
self::awaitChildren();
self::removedShmBlock();
});
}
}