NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


PXI

Reply
Member
DPearce
Posts: 50
0 Kudos
Accepted Solution

thread monitor on realtime system

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?

 

 

 

 

Member
DPearce
Posts: 50
0 Kudos

Re: thread monitor on realtime system

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:

 

   CmtDiscardThreadPool (cop_thread_pool);

 

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.

 

My questions:

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?

 

 

Member
JaymeW
Posts: 67
0 Kudos

Re: thread monitor on realtime system

Hi DPearce,

 

This KnowledgeBase article has some information about why CmtDiscardThreadPool causes your program to hang and gives some recommendations for fixing it.

Jayme W.
Applications Engineer
National Instruments
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page