]> granicus.if.org Git - php/commitdiff
Remove PHP_SLEEP_NON_VOID as it is not useful anymore
authorMáté Kocsis <kocsismate@woohoolabs.com>
Thu, 7 Nov 2019 00:10:52 +0000 (01:10 +0100)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Thu, 7 Nov 2019 16:56:26 +0000 (17:56 +0100)
ext/standard/basic_functions.c
ext/standard/tests/general_functions/sleep_basic.phpt
main/php.h
win32/build/config.w32.h.in

index 6135ace457596c0185035631f656ea8d06636bfb..b11311b51c09ea15149409a1bc64f5afd400ab92 100755 (executable)
@@ -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));
 }
 /* }}} */
 
index 0ef0e7c2131f0d3480a2101c70906e892b31547f..d3dd8c44f5a4fd44330fd821b8e891f81515b4e0 100644 (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===
index b014379fda16a41fd2cccc76e9d2131374fba9e1..48c78291d7a643935a955408778fc4d9dd112549 100644 (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) */
index bfe57ed488e08136612284245bfc06f11b0930bf..ca3a19b5ce378fe0e62a83f4cc5f310dc005658e 100644 (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