Re: Interesting sleep() side-effect

From: Date: Wed, 27 Jan 1999 17:18:58 +0000
Subject: Re: Interesting sleep() side-effect
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-3741@lists.php.net to get a copy of this message
Rasmus Lerdorf <rasmus@lerdorf.on.ca> writes: > In testing Thies' connection abort detection code, completely unrelated to > his stuff, I noticed an interesting side-effect of calling sleep() in a > PHP script. I have tried this on both Linux and Solaris and get the same > results. Could you guys with access to other OS'es try this one? > > <? > set_time_limit(5); > register_shutdown_function("done"); > function done() { > global $i; > > $fp = fopen("/tmp/done","w"); > fputs($fp,"i reached $i\n"); > fclose($fp); > } > > for($i=0; $i<30000; $i++) { > for($j=0;$j<1000;$j++) $a=sqrt($j); > /* sleep(1); */ > echo "$i > ................................................................................<br>"; > flush(); > } > ?> > > > This script should run for 5 seconds, setitimer(ITIMER_PROF, ...) measures CPU time, not real time. Tom. -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3741) next »