Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Overflowing the Windows’s message Queue Pin
David Crow8-Jan-09 9:08
David Crow8-Jan-09 9:08 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ8-Jan-09 10:03
BobInNJ8-Jan-09 10:03 
GeneralRe: Overflowing the Windows’s message Queue Pin
David Crow8-Jan-09 10:13
David Crow8-Jan-09 10:13 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ8-Jan-09 11:12
BobInNJ8-Jan-09 11:12 
QuestionRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 12:11
Roger Stoltz8-Jan-09 12:11 
GeneralRe: Overflowing the Windows’s message Queue Pin
Luc Pattyn8-Jan-09 13:21
sitebuilderLuc Pattyn8-Jan-09 13:21 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 22:30
Roger Stoltz8-Jan-09 22:30 
AnswerRe: Overflowing the Windows’s message Queue Pin
BobInNJ8-Jan-09 14:24
BobInNJ8-Jan-09 14:24 
Roger,


First, I want to thank you for your response. My program is simulated a financial process many times. My plan is to have one worker thread for each cpu or core on the machine. The basic outline is that the worker Thread does a simulation, reports the results to the GUI thread and then repeats the process. Typically, the process needs to be repeated about 10,000 times. However, this number is under user control and might be as high as 1,000,000. Each simulation takes about 10ms seconds depending on the data. At the moment, the amount of data it is reporting is about 16 bytes. This might increase a bit.

I am thinking that you are right, and that I need to redesign the application. My current thinking is not to use the Window’s message queue but instead have the worker thread call a method in the user’s object. I am going to call this method, reportingMethod. Now, suppose that two threads call this method at the same time, then I am going to have a problem. Therefore, I need to protect myself from this situation. My plan is do the following:

<br />
GUIClass:: ReportingMethod ( struct Report rep )<br />
{<br />
	CSingleLock singleLock( &amp;m_CritSection );<br />
	singleLock.Lock();<br />
<br />
	// Note: The 5 lines are not C++ but pseudo code.<br />
        copy the data<br />
        increment counter<br />
        if counter % 4 == 0<br />
            repaint the window<br />
        end if<br />
<br />
        singleLock.Unlock();<br />
<br />
}<br />


In the above example, m_CritSection is of type CCriticalSection and a member of the class GUICLASS. Do you or anybody else see a problem with this approach? Do I have the locking code right?

Bob
GeneralRe: Overflowing the Windows’s message Queue Pin
Cedric Moonen8-Jan-09 20:27
Cedric Moonen8-Jan-09 20:27 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 22:54
Roger Stoltz8-Jan-09 22:54 
GeneralRe: Overflowing the Windows’s message Queue Pin
Cedric Moonen8-Jan-09 22:57
Cedric Moonen8-Jan-09 22:57 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 23:05
Roger Stoltz8-Jan-09 23:05 
GeneralRe: Overflowing the Windows’s message Queue Pin
Luc Pattyn9-Jan-09 1:31
sitebuilderLuc Pattyn9-Jan-09 1:31 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz9-Jan-09 1:44
Roger Stoltz9-Jan-09 1:44 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ9-Jan-09 6:31
BobInNJ9-Jan-09 6:31 
GeneralRe: Overflowing the Windows’s message Queue Pin
Roger Stoltz8-Jan-09 23:11
Roger Stoltz8-Jan-09 23:11 
AnswerRe: Overflowing the Windows’s message Queue Pin
Rolf Kristensen10-Jan-09 2:02
Rolf Kristensen10-Jan-09 2:02 
GeneralRe: Overflowing the Windows’s message Queue Pin
BobInNJ10-Jan-09 8:47
BobInNJ10-Jan-09 8:47 
GeneralRe: Overflowing the Windows’s message Queue Pin
Rolf Kristensen11-Jan-09 1:15
Rolf Kristensen11-Jan-09 1:15 
QuestionEdit control with HTML link Pin
sabapathy_808-Jan-09 5:00
sabapathy_808-Jan-09 5:00 
AnswerRe: Edit control with HTML link Pin
Iain Clarke, Warrior Programmer8-Jan-09 5:04
Iain Clarke, Warrior Programmer8-Jan-09 5:04 
GeneralRe: Edit control with HTML link Pin
sabapathy_808-Jan-09 5:14
sabapathy_808-Jan-09 5:14 
GeneralRe: Edit control with HTML link Pin
David Crow8-Jan-09 9:10
David Crow8-Jan-09 9:10 
GeneralRe: Edit control with HTML link Pin
sabapathy_809-Jan-09 6:20
sabapathy_809-Jan-09 6:20 
GeneralRe: Edit control with HTML link Pin
David Crow9-Jan-09 6:29
David Crow9-Jan-09 6:29 

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.