ni / nidaqmx-python

A Python API for interacting with NI-DAQmx
Other
428 stars 154 forks source link

Can't close tasks in an event callback when using gRPC #559

Open texasaggie97 opened 5 months ago

texasaggie97 commented 5 months ago

test___done_event_registered___call_clear_in_callback___stop_close_in_callback_with_success_status and test___every_n_samples_event_registered___call_clear_in_callback___stop_close_in_callback_with_success_status fail when closing a task in an event callback.

This is supported when not using gRPC

zhindes commented 5 months ago

task.close() closes all open event handlers and then GrpcEventHandler.close() joins its event thread. When calling task.close from the event itself, the current thread is the event thread. A thread joining itself doesn't work so well. I think we just need a check for that case.