Click here to Skip to main content
15,909,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Strange Code in MFC Source Pin
l a u r e n17-Apr-02 21:13
l a u r e n17-Apr-02 21:13 
GeneralRe: Strange Code in MFC Source Pin
Michael Dunn17-Apr-02 13:33
sitebuilderMichael Dunn17-Apr-02 13:33 
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 
Some details are missing to make a full evaluation of this approach, but IMHO the possibility of a deadlock is lurking in your design.
If your dialog features a cancel button, and you implement it like this:
void CProgressDialog::OnCancel()
{
  signal the thread to die;
  wait for the signal to die with WaitForMultipleObject or some similar API;
}
then there's a possible deadlock here. Suppose the user presses the Canel button and CProgressDialog::OnCancel is called. If right after the thread is signalled to die the thread happens to be in an update call to the document, and the updating process involves sending (explicitly or implicitly) some message to CProgressDialog, then you've hit a deadlock, as the thread won't answer the termination signal until it's returned from the update call, and CProgressDialog won't process any further messages until it returns from CProgressDialog::OnCancel. You got it? In general, to avoid such deadlocks between a worker thread and the GUI part of a program, it is advisable to have the worker thread post messages to the GUI instead of sending them in a blocking fashion.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
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 
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 

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.