Re: Allow sleep() to accept non-integer values

From: Date: Thu, 20 Aug 2020 12:55:09 +0000
Subject: Re: Allow sleep() to accept non-integer values
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-111654@lists.php.net to get a copy of this message
Again, I personally don't understand why this could bypass the RFC process, as multiple people have already, me included, voiced their disagreement with this change.
This was proposed by Nikita Popov in his comment
Secondly this change introduces another inconsistency, why can sleep accept a float but not usleep?
Nanosleep and microsleep functions are basically 1:1 of the underlaying implementation. The updated sleep() is however now never worse than the best sleep function available, thus we can use it also for time_nanosleep and usleep php function and accept float. I will implement it.
If there is indeed a need for being able to specify a sleep in milliseconds I'd prefer the introduction of a msleep function then this change.
The issue I solve is sleep function that accepts seconds should accept floating point values as time is continous value. With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Voříšek On 20 Aug 2020 14:25, G. P. B. wrote:
Apologies for the double email, my client did something funcky. On Thu, 20 Aug 2020 at 14:22, G. P. B. <george.banyard@gmail.com> wrote: On Thu, 20 Aug 2020 at 14:15, Michael Voříšek - ČVUT FEL <vorismi3@fel.cvut.cz> wrote: Hi everyone, thank you for your comments, based on them, I fixed these: - usleep is now used as a fallback as well, if interrupted, remaining time is measured using microtime, so return value is always available - for BC, if not interrupted, return value remains to be 0 (integer zero) Now, the sleep() function should be really universal, cross platform and I would say also the prefered way to sleep. The implementaion is here https://github.com/php/php-src/pull/5961/files Please comment on Github directly if you have any feedback left.
I thinkit's worth considering if this also should be fixed in 8.0 or even earlier ;-)So good to hear the RM view on this.
Sara, are you ok to include this in PHP 8.0 and do you require a RFC for it? With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Voříšek
Again, I personally don't understand why this could bypass the RFC process, as multiple people have already, me included, voiced their disagreement with this change. Secondly this change introduces another inconsistency, why can sleep accept a float but not usleep? If there is indeed a need for being able to specify a sleep in milliseconds I'd prefer the introduction of a msleep function then this change. Best regards George P. Banyard

« previous php.internals (#111654) next »