Remove PHP_SLEEP_NON_VOID as it is not useful anymore

This commit is contained in:
Máté Kocsis 2019-11-07 01:10:52 +01:00
parent e710862f8c
commit 662afc80f8
No known key found for this signature in database
GPG key ID: FD055E41728BF310
4 changed files with 5 additions and 9 deletions

View file

@ -2972,7 +2972,7 @@ PHP_FUNCTION(flush)
}
/* }}} */
/* {{{ proto void sleep(int seconds)
/* {{{ proto int sleep(int seconds)
Delay for a given number of seconds */
PHP_FUNCTION(sleep)
{
@ -2986,12 +2986,8 @@ PHP_FUNCTION(sleep)
zend_value_error("Number of seconds must be greater than or equal to 0");
return;
}
#ifdef PHP_SLEEP_NON_VOID
RETURN_LONG(php_sleep((unsigned int)num));
#else
php_sleep((unsigned int)num);
#endif
RETURN_LONG(php_sleep((unsigned int)num));
}
/* }}} */

View file

@ -20,7 +20,7 @@ set_time_limit(20);
$time_start = microtime(true);
// Sleep for a while
sleep($sleeptime);
$result = sleep($sleeptime);
// Test passes if sleeps for at least 98% of specified time
$sleeplow = $sleeptime - ($sleeptime * 2 /100);
@ -29,6 +29,7 @@ $time_end = microtime(true);
$time = $time_end - $time_start;
echo "Thread slept for " . $time . " seconds\n";
echo "Return value: " . $result . "\n";
if ($time >= $sleeplow) {
echo "TEST PASSED\n";
@ -40,5 +41,6 @@ if ($time >= $sleeplow) {
--EXPECTF--
*** Testing sleep() : basic functionality ***
Thread slept for %f seconds
Return value: 0
TEST PASSED
===DONE===

View file

@ -294,7 +294,6 @@ END_EXTERN_C()
/* global variables */
#if !defined(PHP_WIN32)
#define PHP_SLEEP_NON_VOID
#define php_sleep sleep
extern char **environ;
#endif /* !defined(PHP_WIN32) */

View file

@ -44,7 +44,6 @@
/* its in win32/time.c */
#define HAVE_USLEEP 1
#define HAVE_NANOSLEEP 1
#define PHP_SLEEP_NON_VOID 1
#define HAVE_GETCWD 1
#define NEED_ISBLANK 1