Click here to Skip to main content
16,005,682 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Monitor sockets? Pin
pba_25-Jan-02 6:37
pba_25-Jan-02 6:37 
AnswerRe: Monitor sockets? Pin
Chris Hafey26-Jan-02 8:31
Chris Hafey26-Jan-02 8:31 
GeneralTerminating a thread Pin
HomeNuke25-Jan-02 6:00
HomeNuke25-Jan-02 6:00 
GeneralRe: Terminating a thread Pin
25-Jan-02 6:31
suss25-Jan-02 6:31 
GeneralRe: Terminating a thread Pin
pba_25-Jan-02 6:47
pba_25-Jan-02 6:47 
GeneralRe: Terminating a thread Pin
Ernest Laurentin25-Jan-02 6:50
Ernest Laurentin25-Jan-02 6:50 
GeneralRe: Terminating a thread Pin
HomeNuke25-Jan-02 7:04
HomeNuke25-Jan-02 7:04 
GeneralRe: Terminating a thread Pin
25-Jan-02 7:01
suss25-Jan-02 7:01 
"In my ThreadParam struct I added a variable bool Stop. When I start the thread I set stop to false and in the while loop I use an if statement to check for Stop. If it is true I break out of the while loop so the thread can close safely. I change Stop to true in the WM_CLOSE message of the MAIN GUI interface--No success."

Why doesn't it work? Most likely your code to check the bool value was not executed because the worker thread was blocking (waiting for other things). There is no way to terminate a worker thread within itself effectively. If you have the thread handle, you can call TerminateThread from outside, but there are warnings against using TerminateThread (see MSDN).

User interface thread is different because it has a message pump, so it can process the quit message. But it changes the way your program works.

GeneralRe: Terminating a thread Pin
Matt Gullett25-Jan-02 7:42
Matt Gullett25-Jan-02 7:42 
GeneralRe: Terminating a thread Pin
HomeNuke25-Jan-02 7:51
HomeNuke25-Jan-02 7:51 
GeneralRe: Terminating a thread Pin
Ernest Laurentin25-Jan-02 8:47
Ernest Laurentin25-Jan-02 8:47 
GeneralRe: Terminating a thread Pin
HomeNuke25-Jan-02 8:52
HomeNuke25-Jan-02 8:52 
GeneralRe: Terminating a thread Pin
Ernest Laurentin25-Jan-02 9:25
Ernest Laurentin25-Jan-02 9:25 
GeneralRe: Terminating a thread Pin
HomeNuke25-Jan-02 9:28
HomeNuke25-Jan-02 9:28 
GeneralRe: Terminating a thread Pin
Ernest Laurentin25-Jan-02 10:29
Ernest Laurentin25-Jan-02 10:29 
GeneralRe: Terminating a thread Pin
HomeNuke25-Jan-02 11:28
HomeNuke25-Jan-02 11:28 
GeneralRe: Terminating a thread Pin
25-Jan-02 9:43
suss25-Jan-02 9:43 
GeneralRe: Terminating a thread Pin
HomeNuke25-Jan-02 9:42
HomeNuke25-Jan-02 9:42 
GeneralRe: Terminating a thread Pin
25-Jan-02 10:22
suss25-Jan-02 10:22 
GeneralDirectory search Pin
Stan the man25-Jan-02 6:02
Stan the man25-Jan-02 6:02 
GeneralRe: Directory search Pin
pba_25-Jan-02 6:22
pba_25-Jan-02 6:22 
GeneralRe: Directory search Pin
Michael Dunn25-Jan-02 7:06
sitebuilderMichael Dunn25-Jan-02 7:06 
GeneralCWebBrowser Event Handler Pin
Abdiel Jaramillo25-Jan-02 5:40
Abdiel Jaramillo25-Jan-02 5:40 
QuestionHow to convert to BML format??? Pin
sAmAnThA25-Jan-02 5:28
sAmAnThA25-Jan-02 5:28 
GeneralCode Review Pin
Stephen Caldwell25-Jan-02 5:23
Stephen Caldwell25-Jan-02 5:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.