02-19-2010 03:20 AM
Hello,
is there any way to check the state a task is currently in? (I just need to differentiate between started and not started).
In my application I want to create a task, and then a future command will start it if it's not running already.
Thanks!
--Cristina.
Solved! Go to Solution.
02-19-2010 08:45 AM
There is a task property node but the only state information you can get out of it is whether or not it is done running, but there is also a VI that does that for you (Is Task Done.vi).
You could also attempt to start the task running and if it already is you will receive an error that you can use to identify that the task is already running. You can then clear out the error with the Clear Errors.vi so it does not disrupt the rest of your code.
02-19-2010 09:21 AM
Thank you for the explanation!
I'm sorry -- I'm afraid I forgot to mention I am working via C++. Could I perhaps apply the approach you mentioned there -- start the task and see if it starts without error? Or will an already running task be restarted if I start it again? (Haven't worked with VIs, so I am not sure if there are differences between their behaviour and the C++ behaviour). The help manual did not mention anything in this direction.
(Of course I could use a boolean flag that I set manually to false after task creation and to true after task start and check it later, but I thought it would probably be more elegant/efficient if I used a dedicated NIDAQmx function).
02-19-2010 09:24 AM
02-19-2010 10:04 AM
Great, thanks a lot!
--Cristina.