If another proc is running when the time to execute a "spawned" proc arrives, does the spawned proc interrupt the current call stack, execute, and return control to the current call stack, or does it wait until the call stack returns control to the server?
ID:137938
Jun 4 2001, 10:27 am
|
|
In response to Gughunter
|
|
On 6/4/01 1:36 pm Gughunter wrote:
I'm 99% sure the spawned proc will wait until the current proc sleeps or returns. But I *can* tell you that sleep and spawn measure their arguments in real time rather than server ticks. So if you have a sleep(1) and a sleep(2) and there's a lot of CPU usage, they might end up executing on the same tick, in unpredictable order! The lack of control you get by using sleep() or spawn() to control your game is a major reason that I created the event loop library. By using an event loop instead, you can have complete control over the order things happen in, how many things happen each tick, etc. All of my games run on an event loop, and have almost zero spawn()/sleep() calls. |
I'm 99% sure the spawned proc will wait until the current proc sleeps or returns. But I *can* tell you that sleep and spawn measure their arguments in real time rather than server ticks. So if you have a sleep(1) and a sleep(2) and there's a lot of CPU usage, they might end up executing on the same tick, in unpredictable order!