]> granicus.if.org Git - php/commitdiff
make sleep() return it's return value when possible
authorAndrey Hristov <andrey@php.net>
Tue, 2 Nov 2004 17:03:20 +0000 (17:03 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 2 Nov 2004 17:03:20 +0000 (17:03 +0000)
#on some *nix systems sleep() is implemented with SIGALRM. When SIGALRM
#interrupts sleep() it returns the number of seconds that has to be slept
#till the number of seconds wanted by the script. Sleep() on Windows is
# void.

ext/standard/basic_functions.c
main/php.h

index 1eef4d9599157e78a6413b8d19cc15660a80da73..06952095404d1b6d7c2e400ce00e6a2323a0d84d 100644 (file)
@@ -1733,7 +1733,14 @@ PHP_FUNCTION(sleep)
        }
 
        convert_to_long_ex(num);
-       php_sleep(Z_LVAL_PP(num));
+#ifdef PHP_SLEEP_NON_VOID
+       RETURN_LONG(
+#endif
+       php_sleep(Z_LVAL_PP(num))
+#ifdef PHP_SLEEP_NON_VOID
+       )
+#endif
+       ;
 }
 /* }}} */
 
index 945dfb5ce42f07f9ddc3d850b7a83dc1ba7f0fd9..6e5612bde2e457497b3addda9170e8a25928a967 100644 (file)
@@ -252,6 +252,7 @@ char *strerror(int);
 /* global variables */
 extern pval *data;
 #if !defined(PHP_WIN32)
+#define PHP_SLEEP_NON_VOID
 #define php_sleep sleep
 extern char **environ;
 #endif /* !defined(PHP_WIN32) */