Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Callbacks running when task is stopped/cleared

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.

0 Kudos
Message 1 of 3
(3,096 Views)

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.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,070 Views)

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.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(3,070 Views)