|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-14 14:52 UTC] lbarnaud@php.net
[2020-02-07 06:10 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 13:00:01 2026 UTC |
Description: ------------ The return values specified on the top of the page are not correct. At least, not in php 5.2.0 Sleep returns the amount of seconds left when the function exits. Signals for instance, can break a sleep. In that case sleep will return the amount of seconds he didn't get to 'sleep'. Reproduce code: --------------- function alarm_handler() { print "Caught SIGALRM\n"; pcntl_alarm(1); } function term_handler() { print "Caught SIGTERM\n"; } function int_handler() { print "Ctrl+C will not help this time, m8!\n"; } pcntl_signal(SIGALRM, "alarm_handler", true); pcntl_signal(SIGTERM, "term_handler", true); pcntl_signal(SIGINTM, "int_handler", true); pcntl_alarm(1); for(;;) { print sleep(30)." seconds left.\n"; print "reloop and sleeping again.\n"; } Expected result: ---------------- Since the sleep is broken, i'd expect a FALSE as documented Actual result: -------------- however, it returns the amount of seconds remaining before the actual sleep would be over.