Home > Software engineering >  Visual stdio 2008 process may have a deadlock (or is not running any user-mode code). All of the thr
Visual stdio 2008 process may have a deadlock (or is not running any user-mode code). All of the thr

Time:11-14

I haven't reaction of MFC program runs for a long time, click on the "down" after the pop up "process may have a deadlock (or is not running any user-mode code), all threads have been stopped," excuse me everybody a great god what reason is this?
Int nRow=m_listMessage. GetItemCount ();
M_listMessage. InsertItem (nRow, _T (" click on "start" button!" ));//insert row
NRow=m_listMessage. GetItemCount ();
If (nRow & gt; 0)
M_listMessage. EnsureVisible (nRow - 1, FALSE);

Sockaddr_in remoteAddr;
Int nAddrlen=sizeof (remoteAddr);
While (1) {
The SOCKET * ClientSocket=new SOCKET;
ClientSocket=(SOCKET *) malloc (sizeof (SOCKET));
* ClientSocket=accept (slisten, (SOCKADDR *) & amp; RemoteAddr, & amp; NAddrlen);//0, 0);
CreateThread (NULL, 0, & amp; ServerThread, ClientSocket, 0, NULL);
}//while
Closesocket (slisten);
WSACleanup ();
return;//(0);
Step to the accept () that will be stuck, point break, suggesting the tips above "process may have a deadlock (or is not running any user-mode code), all threads have been stopped,"

CodePudding user response:

Accept it isn't in the main interface thread, it is also open a thread

CodePudding user response:

You want to go into the thread, listening is a blocking process, in the main program of the resistance of the main program is dead

CodePudding user response:

Block patterns are blocking the accept function, blocked the message loop, want to open a thread to receive

CodePudding user response:

a non-blocking connect () and the accept ()

CodePudding user response:

You haven't understood the socket connection, the order of the first reading, then writing code.
  • Related