LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a DLL generated by LV in multithreaded Visual C++ program

I'm afraid I don't have much else to advise on...The sequence that I said is what should be done to support MT programs. There are other things to do correctly, such as ensuring the MT correctness of your VI configuration (reentrant vs. non-reentrant), your own C code (see below), etc. I can't run the application you gave because I don't have the I/O Tech library, so it can't find the DLL. Also, I am assuming that you have LV 6.1 from the naming of the routine and I don't have that installed - so the runtime would be different.
 
At this point I would recommend using Visual Studio to track down where exactly the deadlock is occuring, and if it is in the VI's, contact NI support. Sorry I can't be much more help...
 
* Note on C code = You are using unprotected integer values as flags between your threads - this is a bad idea because modern compilers and processors are allowed to reorganize your code as long as the "meaning" doesn't change. This means that the setting of an integer flag can move. Also - on mulit-CPU or multi-core processors, the lack of a lock instruction means the processor caches are not sync'ed - causing even more uncertainty. You should replace those calls with calls to the InterlockedIncrement/Decrement APIs.
0 Kudos
Message 21 of 22
(651 Views)
Thank you for trying to help me...
0 Kudos
Message 22 of 22
(635 Views)