nidaqmx-python icon indicating copy to clipboard operation
nidaqmx-python copied to clipboard

Information on callback execution

Open gabcavic opened this issue 1 year ago • 2 comments

Hi, I am building an application including real-time streaming of data from the DAQ. I would need some information on the execution models of callbacks such as those provided to functions register_every_n_samples_acquired_into_buffer_event. What happens when the task is running and this callback is executed? Is there a parallel thread launching the event and executing the callback? Is it a blocking execution?

I couldn't find anything in the documentation, but since the execution model in Python can be various (multiprocessing, asynchronous, thread-based, etc) it would be nice to have some clarification on this point.

gabcavic avatar Oct 29 '24 17:10 gabcavic

The implementation is this:

You can see that we pass 0 for the options parameter in task.py. The documentation says

The callback function is called in a DAQmx thread. This is the default value.

If this is useful, feel free to make a PR to task.py to update the documentation! If there are more questions you have, let me know. I can dig into the internal code deeper.

zhindes avatar Oct 29 '24 23:10 zhindes

THank you very much for the answer! As soon as I will have a bit of time I will prepare the PR

gabcavic avatar Nov 01 '24 20:11 gabcavic