views:

376

answers:

2

We have an application that uses the window message queue to pass data from a socket to consumer HWNDs (at a rate of ~2100Hz). This application has worked for >2 years. Recently our application has started exhibiting problems where WM_TIMER is not being fired/executed by our application. I think this is due to the data being pumped into the message queue.

My question is there a way to determine how many pending messages are in the message queue for a given thread/HWND?

A: 

Hi Tall,

There isn't a good way to do this. One thing you could do is aggressively empty the message que and put them in your own queue. But, this will not solve your problem.

I hate telling you this, but you should really find a way to process your socket data. I think you will find some other mechanism scales better, performs better, and is easier to debug than using the windows message queue for this.

Foredecker

Foredecker
Thanks, That was what I was afraid of. I was just wanting to see how deep the message queue was getting to verify that my problem was in that bit of code before redesigning that data flow.
tallganglyguy
+2  A: 

This is answered in really great detail by Raymond Chen in his post "but then we ran into problems when we started posting 10,000 messages per second".

The research team asked to meet with the user interface team to help work out their problems under load. They outlined their design and explained that it worked well at low data rates, "but then we ran onto problems when we started posting 10,000 messages per second."

At that point, the heads of all the user interface people just sat there and boggled for a few seconds.

"That's like saying your Toyota Camry has stability problems once you get over 500 miles per hour."

1800 INFORMATION