Concurrency, or parallel processing or background tasks
Posted: Fri Jul 04, 2008 3:03 pm
... or multi-tasking or even co-routines, whatever you call them.
I'd like to know how to run a handler while another one is running too.
E.g. I want a handler Accelerator to move graphic stuff around on a card continuously.
Then I want two buttons: Inject and Dump.
When I press Inject it should do some preparations and then call handler Accelerator.
Accelerator would then move things around indefinitely, i.e. it has a repeat forever (with no condition), perhaps testing a flag at each cycle.
Button Dump would in its handler do some preparations and checks, while handler Accelerator is still running. Having done its checks and preparations, Dump might then lower the flag which would cause Accelerator to stop. It should actually be able to interrupt Accelerator.
How can one do that?
Of course I can put everything in a single huge handler and test each cycle if the mouse is down and if it is within the rectangle of such and such a button, but that's defeating the purpose of multi-tasking.
I looked in the documentation but must have missed something.
Robert.
I'd like to know how to run a handler while another one is running too.
E.g. I want a handler Accelerator to move graphic stuff around on a card continuously.
Then I want two buttons: Inject and Dump.
When I press Inject it should do some preparations and then call handler Accelerator.
Accelerator would then move things around indefinitely, i.e. it has a repeat forever (with no condition), perhaps testing a flag at each cycle.
Button Dump would in its handler do some preparations and checks, while handler Accelerator is still running. Having done its checks and preparations, Dump might then lower the flag which would cause Accelerator to stop. It should actually be able to interrupt Accelerator.
How can one do that?
Of course I can put everything in a single huge handler and test each cycle if the mouse is down and if it is within the rectangle of such and such a button, but that's defeating the purpose of multi-tasking.
I looked in the documentation but must have missed something.
Robert.