Use less resource while waiting

BlitzMax Forums/BlitzMax Programming/Use less resource while waiting

andre72(Posted 2007) [#1]
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


LAB[au](Posted 2007) [#2]
TimerTicks?


SebHoll(Posted 2007) [#3]
You could use WaitSystem() in your main loop with timers to halt execution until a timer tick is fired...


Dreamora(Posted 2007) [#4]
With a check every second it does not use any idle time that is worth mentioning by todays CPU time scale.


ImaginaryHuman(Posted 2007) [#5]
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.


ziggy(Posted 2007) [#6]
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.