10-18-2013 01:52 PM
When a task is stopped, does DAQmxStopTask() block until any callbacks running in DAQmx threads for the task have completed? How about when the task is cleared?
DAQmxRegisterEveryNSamplesEvent()'s documentation says that DAQmxStopTask() will discard all pending callbacks, but makes no statement about what happens if some are already running when the task is stopped.
10-21-2013 06:32 PM
Hello,
I believe that if the "event" has already completed and the callback funtion begins to execute, then the function will finish execution even if the DAQmxStopTask() function has already been called. In this case the "event" would be a specified number of samples written to the buffer. If this specified number of samples has not yet been written (pending state) and the DAQmxStopTask() function is called, then the callback function will not execute.
As far as the DAQmxClearTask() function goes, it performs the same function as the stop task function (provided the stop task function is not called prior) in addition to releasing the DAQmx resources that have been reserved by the DAQmxCreateVirtualChannel function. This means that it should exhibit the same behavior as the DAQmxStopTask() function when it comes to the event callback.
10-21-2013 06:32 PM
Hello,
I believe that if the "event" has already completed and the callback funtion begins to execute, then the function will finish execution even if the DAQmxStopTask() function has already been called. In this case the "event" would be a specified number of samples written to the buffer. If this specified number of samples has not yet been written (pending state) and the DAQmxStopTask() function is called, then the callback function will not execute.
As far as the DAQmxClearTask() function goes, it performs the same function as the stop task function (provided the stop task function is not called prior) in addition to releasing the DAQmx resources that have been reserved by the DAQmxCreateVirtualChannel function. This means that it should exhibit the same behavior as the DAQmxStopTask() function when it comes to the event callback.