07-09-2012 05:11 PM
I have a PXIe-8101 controller in my PXI system. I have it running with a realtime operating system. I inherited some CAN software that was used on a LabWindows program used on a PC with a Windows 7 operating system. The CAN software seems to run OK. My problem is when I exit the program I get a NON-FATAL RUN-TIME ERROR
Unknown source position thread id 0x000000EC
Your CVI program has exited on the real-time target. However, there are still threads on the real-time target that are running or have previously run CVI code.
Please verify that your application cleans up all of its threads. Threads left running after your application exits can crash the real-time target when your application is unloaded.
As I said I inherited the code and there is a lot of it. I am looking for a clever way to hunt down these threads. I was wondering if there are any tools available that could help with this? Or any other suggestions on how to run these down?
Solved! Go to Solution.
07-10-2012 01:51 PM
I've narrowed down my problem a bit so wanted to add this information. I think I found the phantom thread.
I created it with this function call.
cmtStatus = CmtNewThreadPool(2, &cop_thread_pool);
So I thin this is great; all I need to do is call: CmtDiscardThreadPool() and the thread will be stopped. So I call it:
But this causes my program to hang. I look at the help on CmtDiscardThreadPool() and it says:
Do not call this function while you are inside a DLL DllMain function. If you call CmtDiscardThreadPool from DLLMain, your program will hang.
Since my program is a realtime application and is a DLL ( my main is void CVIFUNC_C RTmain (void)) I figure this must apply to my program too.
Is my understanding of this correct?
What would be a good way to fix this problem?
Should I start the thread in another way for this DLL?
07-11-2012 05:07 PM
This KnowledgeBase article has some information about why CmtDiscardThreadPool causes your program to hang and gives some recommendations for fixing it.