On Wed, Nov 12, 2003 at 10:02:38PM -0000, Ilia Alshanetsky wrote: > iliaa Wed Nov 12 17:02:38 2003 EDT > > Modified files: > /php-src NEWS > /php-src/ext/standard basic_functions.c basic_functions.h > Log: > Added nanosleep(), in addition to allowing setting of very short states. > This function is signal safe.
nanosleep() does not exist on all Unixes at least, this will need an autoconf check... > +/* {{{ proto mixed nanosleep(long seconds, long nanoseconds) > + Delay for a number of seconds and nano seconds */ > +PHP_FUNCTION(nanosleep) > +{ > + long tv_sec, tv_nsec; > + struct timespec php_req, php_rem; > + > + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tv_sec, &tv_nsec)) > { > + WRONG_PARAM_COUNT; > + } > + > + php_req.tv_sec = (time_t) tv_sec; > + php_req.tv_nsec = tv_nsec; > + if (!nanosleep(&php_req, &php_rem)) { > + RETURN_TRUE; > + } else if (errno == EINTR) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php