02-11-2021 12:07 AM
Is it possible to call DAQmxWriteDigitalLines in different threads for different lines? or will every call have to be thread locked?
DAQmxCreateTask ("", &DOCARD);
DAQmxCreateDOChan (DOCARD, text, "",DAQmx_Val_ChanPerLine);
DAQmxStartTask(DOCARD);
DAQmxWriteDigitalLines (DOCARD, 1, 1, 10,
DAQmx_Val_GroupByScanNumber,
&DOArray[0],
DAQmxStopTask(DOCARD) ;
DAQmxClearTask(DOCARD)
02-12-2021 12:41 AM
Hi,
I believe DAQmx library is already multi-thread safe.
But the code snippet you provided does not look optimal. Do not create/clear tasks too often.
I usually create once at the beginning of my application and clear when exiting. That works for most of the projects.
Even Start/stop is not required too often.
So, create your tasks during initalization. Start when test/process starts and then read/write when required in whichever thread.
does not that scenario work for you?