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

C / C++ / MFC

 
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 
GeneralRe: Terminating a thread Pin
Matt Gullett25-Jan-02 7:42
Matt Gullett25-Jan-02 7:42 
"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."

First thing that popped into my head was "is 'Stop' a volatile variable and is it a managed resource? (Do you use a critical section to control who is accessing it? Suggestion: If this is how you want to stop your thread this could work. I would recommend using a short instead of a bool. This way it can have states. Ie. 0=Thread running, 1=Request a stop and 2=Thread stopped. Then you GUI thread can check this before actually closing the window.

Second thing that popped into my head is that Stop shold work uness the code you are using in your while loop is blocking and thus never checking Stop.

Matt Gullett


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 
GeneralRe: Code Review Pin
lucy25-Jan-02 9:39
lucy25-Jan-02 9:39 

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.