note 103564 added to function.pcntl-alarm
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 20 Apr 2011 16:04:58 +0000 |
| Subject: | note 103564 added to function.pcntl-alarm | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179006@lists.php.net to get a copy of this message | ||
If your process uses SIGALRM and sleep() at the same time, the alarm set could make sleep() to
return prematurely.
To avoid this and ensure your process waits a number of seconds you could use a function of class
similar to this one:
<?php
class SleepWorkaroundForSIGALRM {
private $time;
function __construct($seconds) {
$this->time = time() + $seconds;
while ($this->time >= time()) {
sleep(1);
}
}
?>
----
Server IP: 80.64.47.13
Probable Submitter: 217.116.1.84
----
Manual Page -- http://www.php.net/manual/en/function.pcntl-alarm.php
Edit -- https://master.php.net/note/edit/103564
Del: integrated -- https://master.php.net/note/delete/103564/integrated
Del: useless -- https://master.php.net/note/delete/103564/useless
Del: bad code -- https://master.php.net/note/delete/103564/bad+code
Del: spam -- https://master.php.net/note/delete/103564/spam
Del: non-english -- https://master.php.net/note/delete/103564/non-english
Del: in docs -- https://master.php.net/note/delete/103564/in+docs
Del: other reasons-- https://master.php.net/note/delete/103564
Reject -- https://master.php.net/note/reject/103564
Search -- https://master.php.net/manage/user-notes.php