LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't trace into thread created by CreateThread

I set breakpoint in the thread FuncB, but can't step into it although it's executed actually.

int FuncB(void);
DWORD WINAPI Thread_Loop(LPVOID lpParam);

void FuncA(void)
{
....

CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Thread_Loop,0,0,&ThreadSSID);

MessagePopup ("Stop here", "Shall I continue?");

}

// ====== Thread of Loop ======
DWORD WINAPI Thread_Loop(LPVOID lpParam)
{
int i=0;

do{
FuncB();
ProcessSystemEvents();
i++;
}while(i<15);

return 1;
}

What's more, it will crash in do-while loop.
Am I wrong somewhere?

Any help be appreciated.
0 Kudos
Message 1 of 4
(3,982 Views)
What do you mean "step into it"? Threads are simultaneously executing, so there isn't a logical step from one thread to another If you are using CVI 5.5 or above, then we do support multithreaded debugging and it should work with threads created with our functions or SDK functions. To switch between threads during debugging, you would go to Run->Threads... in the menu. Then in the threads dialog, pick the thread you want to step through and press the View button. That will take you to that thread.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,982 Views)
I am using CVI 5.0 & Win98. So I can't do multithreaded debugging and view the thread execution step by step, can I? It's OK. I can do without it.
But another problem is: Why the do-while loop in the thread crash? It seems like the system resources are used out (I am not sure about the reason). Can you give me some advice?
0 Kudos
Message 3 of 4
(3,982 Views)
No, you won't be able to do multithreaded debugging without upgrading. I can really speculate why you are getting a crash from the information you gave. I'm not sure what the cause would be.

Chris
0 Kudos
Message 4 of 4
(3,982 Views)