LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple async timer

How can I start a second async timer with a new TimerID when the first has finished ? I tried to call NewAsyncTimer when an event EVENT_DISCARD occurs on the first, but it crashed with the message : "unknown source position, thread ID 0x00000BE8". Where can I find examples with multiple async timers (asyncdem.c is for one single timer only) ?
0 Kudos
Message 1 of 2
(2,814 Views)
The 'unknown source position' message is NOT the exact error message: before this one there should be another message that states the real error code and that can help you in debugging your app.
Anyway, there should be no problem in running multiple timers in a program, especially if, as you say, the new one is started when the old one ends.
One possible problem can arise in starting the new timer while stil ending the preceding one: I personally will try to insert in the callback a PostDeferredCall to another function (that executes when the first one has finisched) that starts the new timer.
Also, as the help for DiscardAsyncTimer states "A call to create or discard an asynchronous timer will not complete(will block) until all outstanding asynchronous ca
llbacks return", I will add some way of knowing if the callbacks have finished or not (some global flag set to 1 if running and to 0 at the end, the way to implement it depends on your program's structure).


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,814 Views)