diff --git a/EProcess/Adapter/PThreads.php b/EProcess/Adapter/PThreads.php index d694406..a82b332 100644 --- a/EProcess/Adapter/PThreads.php +++ b/EProcess/Adapter/PThreads.php @@ -20,6 +20,10 @@ public function create($class, array $data = []) $node = uniqid('thread_'); $unix = sprintf('unix://tmp/%s.sock', $node); + register_shutdown_function(function() use ($unix) { + unlink($unix); + }); + $messenger = MessengerFactory::server($unix, $this->loop); $this->process = new Thread($unix, $class, $data); diff --git a/EProcess/Adapter/SymfonyProcess.php b/EProcess/Adapter/SymfonyProcess.php index 6e0bfac..d9baf54 100644 --- a/EProcess/Adapter/SymfonyProcess.php +++ b/EProcess/Adapter/SymfonyProcess.php @@ -58,6 +58,10 @@ public function create($class, array $data = []) $node = uniqid('thread_'); $unix = sprintf('unix://app/cache/%s.sock', $node); + register_shutdown_function(function() use ($unix) { + unlink($unix); + }); + $messenger = MessengerFactory::server($unix, $this->loop); $script = sprintf($this->script, EPROCESS_AUTOLOAD, $unix, $class, base64_encode($this->serialize($data)));