Home > Software engineering >  The phenomenon of different debugging and runtime
The phenomenon of different debugging and runtime

Time:09-16

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.

CodePudding user response:

reference 1st floor schlafenhamster response:
This function is primarily designed for use by the debuggers . It is not intended to be, informs the for thread synchronization.

1. I have done the experiment, there are two procedures, a program, a new thread with SuspendThread (put up), another program, behind me IsThreadSuspend function use to judge success ah, two programs are two processes, then why does this can?
2. If you feel SuspendThread function can't use, that I want to stop the thread, what to do,

CodePudding user response:

A search for "SuspendThread ()"

CodePudding user response:

Calls SuspendThread (), the function return value indicates that the previous suspend count,

CodePudding user response:

The
reference 4 floor 7-eleven's response:
calls SuspendThread (), the function return value indicates that the previous suspend count,

suspend count of what you say is in this procedure, that if I judge it in another program, suspend count is not important, I want to know is, why the debugging and running, inconsistent application show, then I hang it with no success, and success is why IsThreadSuspend this function has no identification to
  • Related