hello, I have a difficult problem, consult everybody, I have a program to judge the newly created thread, whether hangs, if hang, play a prompt box, said condition is met, but I clearly put up procedures, prompt box is not play, so do the debugging, the result is unexpected, as long as it is debugging, program and expected the same pop-up prompts, but as long as it is running state, prompt box have no, very strange, what is wrong with this, debugging and running the program did not change, also should not have distinction, AfxMessageBox and MessageBox also often use, also don't have any abnormal situation, have never met this kind of thing, who can tell me how to return a responsibility? Below is the code:
G_pThread - & gt; SuspendThread ();//hung thread
Int nPid=_getpid (); BOOL bRET=IsThreadSuspend (nPid g_pThread - & gt; M_nThreadID);//thread hanging function, validation before, no problemIf (bRET) { AfxMessageBox (" threads are hung up!" ); MessageBox (" threads are hung up!" ); }
play don't play prompt box is not important, prompt box just tell me the procedure go, the key is why there are different, IsThreadSuspend this function I was verified, run directly in other programs, is normal,
CodePudding user response:
This function is primarily designed for use by the debuggers . It is not intended to be, informs the for thread synchronization.