View Single Post
  #1  
Old 02-24-2007, 11:59 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Sleep in timeout...

Causes strange problems.

I have sleep(0.05); in a quite complicated script. It's actually inside a loop in a timeout.

The problem is, not only does it seem to stop the timeout, it seems to also stop the loop.

heres what I have:

PHP Code:
function onTimeout() {
for(
i=0;i<=20;i++) {
     if (
== 20this.extended true;
     
     if (!
this.extended && (== 0)) {
          
sleep(0.05);
          
setTimer(0.05);

     }
//Code here never gets executed
}
... 
I tried restarting the timer after calling sleep() but the rest of the stuff after sleep(); in the timeout never gets executed.

edit: actually, it is being executed, but for some reason it's not working as it does without the sleep()
__________________

Coming soon (Hopefully:P)
Reply With Quote