Click here to Skip to main content
15,898,996 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionYielding Messages.... Pin
Peter Weyzen7-Oct-08 19:23
Peter Weyzen7-Oct-08 19:23 
AnswerRe: Yielding Messages.... Pin
Roger Stoltz7-Oct-08 22:24
Roger Stoltz7-Oct-08 22:24 
GeneralRe: Yielding Messages.... Pin
Peter Weyzen7-Oct-08 22:33
Peter Weyzen7-Oct-08 22:33 
GeneralRe: Yielding Messages.... Pin
Mark Salsbery8-Oct-08 5:55
Mark Salsbery8-Oct-08 5:55 
QuestionThread question Pin
monsieur_jj7-Oct-08 19:19
monsieur_jj7-Oct-08 19:19 
AnswerRe: Thread question Pin
Michael Dunn7-Oct-08 19:37
sitebuilderMichael Dunn7-Oct-08 19:37 
GeneralRe: Thread question Pin
monsieur_jj7-Oct-08 20:05
monsieur_jj7-Oct-08 20:05 
GeneralRe: Thread question Pin
Cedric Moonen7-Oct-08 20:12
Cedric Moonen7-Oct-08 20:12 
That's not very smart because you don't have any handle to the first created threads anymore, only the last one (it is a bit like a pointer, if you store another address in it, you loose the previous one).

By the way, what do you mean be close ? You should TerminateThread, but let the thread close nicely (e.g, you set a flag that specifies the thread should finish and the thread will react on this flag and stop nicely).

Also, It seems your code doesn't make a lot of sense: you are starting a new thread to download something (as far as I understood) but then you sleep 100 msec (probably to wait until the thread has finished its work) and then return the result. This doesn't make any sense: why are you creating a thread if this is done sequentially, there's no added value in having a thread doing that. Furthermore, there's a race condition here: if the sleep finishes before your thread has done its work, then you will return a wrong result.

Cédric Moonen
Software developer

Charting control [v1.5]
OpenGL game tutorial in C++

GeneralRe: Thread question Pin
monsieur_jj7-Oct-08 20:23
monsieur_jj7-Oct-08 20:23 
GeneralRe: Thread question Pin
Cedric Moonen7-Oct-08 20:29
Cedric Moonen7-Oct-08 20:29 
QuestionFunction calling in header file Pin
Davitor7-Oct-08 19:05
Davitor7-Oct-08 19:05 
AnswerRe: Function calling in header file Pin
ThatsAlok7-Oct-08 19:18
ThatsAlok7-Oct-08 19:18 
GeneralRe: Function calling in header file Pin
Davitor7-Oct-08 19:26
Davitor7-Oct-08 19:26 
GeneralRe: Function calling in header file Pin
ThatsAlok7-Oct-08 20:00
ThatsAlok7-Oct-08 20:00 
AnswerRe: Function calling in header file Pin
Cedric Moonen7-Oct-08 20:15
Cedric Moonen7-Oct-08 20:15 
AnswerRe: Function calling in header file Pin
CPallini7-Oct-08 23:06
mveCPallini7-Oct-08 23:06 
AnswerRe: Function calling in header file Pin
Bram van Kampen8-Oct-08 9:03
Bram van Kampen8-Oct-08 9:03 
QuestionPrinter HW Serial Number Pin
Bram van Kampen7-Oct-08 15:04
Bram van Kampen7-Oct-08 15:04 
AnswerRe: Printer HW Serial Number Pin
Garth J Lancaster7-Oct-08 16:14
professionalGarth J Lancaster7-Oct-08 16:14 
AnswerRe: Printer HW Serial Number Pin
Mark Salsbery8-Oct-08 6:18
Mark Salsbery8-Oct-08 6:18 
AnswerRe: Printer HW Serial Number Pin
Mark Salsbery8-Oct-08 6:27
Mark Salsbery8-Oct-08 6:27 
QuestionI get compile error c2440 it tells me cannot convert from void please help Pin
nah13377-Oct-08 9:26
nah13377-Oct-08 9:26 
AnswerRe: I get compile error c2440 it tells me cannot convert from void please help Pin
Cedric Moonen7-Oct-08 20:16
Cedric Moonen7-Oct-08 20:16 
GeneralRe: I get compile error c2440 it tells me cannot convert from void please help Pin
nah13377-Oct-08 22:57
nah13377-Oct-08 22:57 
GeneralRe: I get compile error c2440 it tells me cannot convert from void please help Pin
nah13378-Oct-08 0:32
nah13378-Oct-08 0:32 

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.