Click here to Skip to main content
15,914,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Strange Code in MFC Source Pin
Joel Matthias17-Apr-02 19:57
Joel Matthias17-Apr-02 19:57 
GeneralRe: Strange Code in MFC Source Pin
Stan Shannon17-Apr-02 13:34
Stan Shannon17-Apr-02 13:34 
GeneralRe: Strange Code in MFC Source Pin
Mike Nordell17-Apr-02 13:55
Mike Nordell17-Apr-02 13:55 
GeneralRe: Strange Code in MFC Source Pin
Tim Smith18-Apr-02 2:09
Tim Smith18-Apr-02 2:09 
GeneralMultithreading :: MFC Pin
valikac17-Apr-02 11:23
valikac17-Apr-02 11:23 
GeneralRe: Multithreading :: MFC Pin
Joaquín M López Muñoz17-Apr-02 11:51
Joaquín M López Muñoz17-Apr-02 11:51 
GeneralRe: Multithreading :: MFC Pin
valikac17-Apr-02 13:33
valikac17-Apr-02 13:33 
GeneralRe: Multithreading :: MFC Pin
Joaquín M López Muñoz17-Apr-02 19:52
Joaquín M López Muñoz17-Apr-02 19:52 
I do not quite understand what you meant with "sending them in a blocking fashion."

SendMessage, when issued from a worker thread, does not return until the GUI thread processes the message sent. So if the GUI is stuck, SendMessage will wait forever. PostMessage, on the other hand, only leaves the message in the GUI thread message queue and returns immediately.

You were right on with OnCancel(). The way I planned to "signal the thread to die" is by using a boolean counter. OnCancel() would send a message to Doc. Doc would then set the counter to false. Meanwhile, the worker thread does its job only if counter is true.

The deadlock will happen only if OnCancel waits for the thread to actually die before returning (which is the proper way to proceed, on the other hand).

Do you mean it is advisable to *post message* instead of *send message*?

Yes. Be careful with the parameters accompanying a posted message --they mustn't be pointers to temporary variables.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Multithreading :: MFC Pin
valikac17-Apr-02 20:42
valikac17-Apr-02 20:42 
GeneralChanging Font sizes Pin
17-Apr-02 11:19
suss17-Apr-02 11:19 
GeneralRe: Changing Font sizes Pin
Shog917-Apr-02 11:27
sitebuilderShog917-Apr-02 11:27 
GeneralRe: Changing Font sizes Pin
17-Apr-02 13:15
suss17-Apr-02 13:15 
GeneralVisual Studio .Net - files in workspace aren't alphabetical Pin
Brit17-Apr-02 10:14
Brit17-Apr-02 10:14 
GeneralRe: Visual Studio .Net - files in workspace aren't alphabetical Pin
Mike Nordell17-Apr-02 10:43
Mike Nordell17-Apr-02 10:43 
GeneralRe: Visual Studio .Net - files in workspace aren't alphabetical Pin
Anders Molin17-Apr-02 11:59
professionalAnders Molin17-Apr-02 11:59 
GeneralRe: Visual Studio .Net - files in workspace aren't alphabetical Pin
Mike Nordell17-Apr-02 12:22
Mike Nordell17-Apr-02 12:22 
QuestionVirtual desktops? Pin
generic_user_id17-Apr-02 9:35
generic_user_id17-Apr-02 9:35 
AnswerRe: Virtual desktops? Pin
Mike Nordell17-Apr-02 9:54
Mike Nordell17-Apr-02 9:54 
GeneralRe: Virtual desktops? Pin
generic_user_id17-Apr-02 11:10
generic_user_id17-Apr-02 11:10 
GeneralRe: Virtual desktops? Pin
Mike Nordell17-Apr-02 11:59
Mike Nordell17-Apr-02 11:59 
GeneralRe: Virtual desktops? Pin
generic_user_id18-Apr-02 4:02
generic_user_id18-Apr-02 4:02 
GeneralA CPropertySheet, a CPropertyPage and a thread. Oh dear. Pin
17-Apr-02 9:22
suss17-Apr-02 9:22 
GeneralRe: A CPropertySheet, a CPropertyPage and a thread. Oh dear. Pin
Joaquín M López Muñoz17-Apr-02 9:57
Joaquín M López Muñoz17-Apr-02 9:57 
QuestionCombo Box Uneditable? Pin
17-Apr-02 9:06
suss17-Apr-02 9:06 
AnswerRe: Combo Box Uneditable? Pin
Shog917-Apr-02 9:10
sitebuilderShog917-Apr-02 9:10 

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.