Re: A sleeping task
- Posted by Robert Craig <rds at RapidEuphoria.com> Oct 12, 2005
- 454 views
Juergen Luethje wrote: > in the new multitasing system, when sleep() is called in one task, not > only this task "gives some time slices to the operating system", but the > whole Euphoria program goes to bed. > > Asking mainly out of curiosity: Is it possible and/or desirable that > sleep() would only affect the task that calls it? That's a good question. I guess in some cases you might want the whole program to sleep, and in other cases you might want only the current task to sleep. To make just the current task sleep, you could code something like:
task_schedule(task_self(), {3, 3}) task_yield()
This would make the current task sleep for 3 seconds, while allowing other tasks to run. You could even wrap this into a useful routine (task_sleep(n)?) Since, even when multitasking is used, it might be useful to make the whole program sleep, I'll leave sleep() as it is, but I'll document this issue. Thanks, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com