From: Andrey Hristov Date: Tue, 2 Nov 2004 17:03:20 +0000 (+0000) Subject: make sleep() return it's return value when possible X-Git-Tag: RELEASE_0_2~756 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=494d66595543000f7555bfc5c03b7c4209cffa25;p=php make sleep() return it's return value when possible #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. --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 1eef4d9599..0695209540 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -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 + ; } /* }}} */ diff --git a/main/php.h b/main/php.h index 945dfb5ce4..6e5612bde2 100644 --- a/main/php.h +++ b/main/php.h @@ -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) */