Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Commit

Permalink
Add pcntl_sigtimedwait polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
jjsaunier committed Mar 22, 2016
1 parent c4e3ecf commit ac34105
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"react/event-loop": "~0.4.0"
},
"autoload": {
"psr-4": { "Gos\\Component\\PnctlEventLoopEmitter\\": "src/" }
"psr-4": { "Gos\\Component\\PnctlEventLoopEmitter\\": "src/" },
"files": [ "src/functions.php" ]
},
"extra": {
"branch-alias": {
Expand Down
17 changes: 17 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

if (!function_exists('pcntl_sigtimedwait')) {
function pcntl_sigtimedwait($signals, $siginfo, $sec, $nano)
{
pcntl_signal_dispatch();

if (time_nanosleep($sec, $nano) === true) {

return false;
}

pcntl_signal_dispatch();

return true;
}
}

0 comments on commit ac34105

Please sign in to comment.