Page 1 of 1

action repeating

Posted: Fri Feb 11, 2005 3:04 am
by kavaja
HI
I need to create server for one game. But for seerver limits iI must use php instead java. I started yesterday with learning and I dont know if and how this could be done in php: Server must be running everytime from time he is deployed on server to shutdown. He must check game state and be performing nescessary actions every 1/10 of second. Like this in java language:

public void run()
{

while(isALive)
{
//prikazy...
Thread.sleep(100);
}

}

How is it with running this infinity script on server? Are with this any problems??

Thanks for answers

Posted: Fri Feb 11, 2005 3:11 am
by feyd
for one, an infinitely running loop will typically eat the processor on the server, although at .1 second loops, it's less of a problem than most.. but, depending on number of actions needed, that can be using a lot of system resources.

the major thing to do is run it from the command line, or via cron.. using a mutex/semaphore locking mechanism to keep from running concurrently.. You'll have to set the script to have an infinite time limit as well.