Use less resource while waiting
BlitzMax Forums/BlitzMax Programming/Use less resource while waiting
| ||
I need something like a scheduler that only awake when it have to do some of it's task. Eg. taskt1 every 5 minutes, task2 every 10 minutes etc. At the moment I use the multitasking example from the code area and count every second down until is time to execute the tasks. It works fine but I think it needs to much idle time - or not? What solution would you suggest for? Thanks Andre |
| ||
TimerTicks? |
| ||
You could use WaitSystem() in your main loop with timers to halt execution until a timer tick is fired... |
| ||
With a check every second it does not use any idle time that is worth mentioning by todays CPU time scale. |
| ||
Yeah that's not a lot of time but since you're waiting you might as well just let the o/s tell you when it's time by doing a WaitEvent() and an event hook. |
| ||
why don't you just add a SLEEP(1000) in your main loop? this will give 1 full second of IdLe time in each main loop iteration. If your task work at 'seconds' resolution, this could do the trick. |