10-24-2017 04:28 PM
I am trying to read a FIFO that I have configured as Target to Host - DMA. When I run the following code on the same thread that calls NiFpga_Initialize() and NiFpga_Open() the following code works; if I call it from a worker thread (I guarantee that the session hasn't been closed or NiFpga_Finalize() called) it crashes the program.
uint64_t buffer[4096]; size_t toRead; NiFpga_ReadFifoU64(session, NiFpga_FirmwareSettings_TargetToHostFifoU64_MY_FIFO, buffer, 4096, NiFpga_InfiniteTimeout, &toRead));
Why would this crash in a worker thread but work correctly in the main thread?
Solved! Go to Solution.
10-25-2017 09:48 AM
Going through my code this morning, I have two worker threads. One reads from the FIFO. The other waits on an IRQ and then reads a uint8 when the IRQ is triggered. The crash only happens if both worker threads are running.
10-25-2017 09:56 AM
I just noticed that both threads were being assigned to the same std::thread object. This caused the crash. The crash had nothing to do with the LabVIEW C API.