Click here to Skip to main content
15,904,415 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
I once worked on a project where we used the message queue for sending results to the GUI thread.

We first tried to use an atomic counter to control how many results there was in the message queue (max 1000). And then throttled the worker threads when they were sending results faster than the GUI thread could handle. This also ensured that we wouldn't take all memory available when there was many results.

We ended up with creating a special container, where one could push and pop resuls atomicly. And instead used the message queue to signal that the container changed state from empty to containing messages. And container stopped the worker threads with an event mutex, when the message limit (1000) was reached, and this event-mutex was signalled when the GUI thread had got the message count below 500. We changed to this solution because it was kind of a misuse of the message queue to contain our results, eventhough it was an easy way to get a thread-safe queue.

Guess right solution is not use the message queue at all, but check another queue when the GUI thread is in idle-state. And an even faster solution would be to let the container to have its own memory ¨
manager, where it reuses the allocated results, instead of constantly releasing and allocating results when popping and pushing.
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 
GeneralRe: Edit control with HTML link Pin
sabapathy_809-Jan-09 7:47
sabapathy_809-Jan-09 7:47 
AnswerRe: Edit control with HTML link Pin
Code-o-mat8-Jan-09 7:02
Code-o-mat8-Jan-09 7:02 
AnswerRe: Edit control with HTML link Pin
Hamid_RT8-Jan-09 7:35
Hamid_RT8-Jan-09 7:35 
QuestionShow color at pointer position... Pin
Richard Perrine8-Jan-09 2:49
Richard Perrine8-Jan-09 2:49 
AnswerRe: Show color at pointer position... Pin
toxcct8-Jan-09 2:53
toxcct8-Jan-09 2:53 
GeneralRe: Show color at pointer position... Pin
Richard Perrine8-Jan-09 6:45
Richard Perrine8-Jan-09 6:45 
GeneralRe: Show color at pointer position... Pin
toxcct8-Jan-09 6:51
toxcct8-Jan-09 6:51 
AnswerRe: Show color at pointer position... Pin
Jijo.Raj8-Jan-09 3:17
Jijo.Raj8-Jan-09 3:17 
GeneralRe: Show color at pointer position... Pin
Richard Perrine8-Jan-09 6:46
Richard Perrine8-Jan-09 6:46 
QuestionInvoking a Web Service using Visual C++ .NET Pin
Thomas_Mathews8-Jan-09 1:40
Thomas_Mathews8-Jan-09 1:40 
AnswerRe: Invoking a Web Service using Visual C++ .NET Pin
Hamid_RT8-Jan-09 1:47
Hamid_RT8-Jan-09 1:47 

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.