Message Queue and Threads
-
Hello Everybody! I need some help in understanding Message Queues when creating an UI thread. I have created a thread that does a lengthy action delivered using SendMessage. Whenever I need the thread to complete this action, a PostThreadMessage is post this request to the thread's message queue. This creates a bottleneck at the queue because more messages are being pumped into the queue then they can be processed! Is there a limit to how many messages that a message queue can hold? Any help with this problem is greatly appreciated! :)
-
Hello Everybody! I need some help in understanding Message Queues when creating an UI thread. I have created a thread that does a lengthy action delivered using SendMessage. Whenever I need the thread to complete this action, a PostThreadMessage is post this request to the thread's message queue. This creates a bottleneck at the queue because more messages are being pumped into the queue then they can be processed! Is there a limit to how many messages that a message queue can hold? Any help with this problem is greatly appreciated! :)
Hi, Actually speaking there is no declared limit for the number of messages. But if the same messages are being sent continuously - you could test by using PeekMessage and remove the trailing messages for each message(the specific kind) you are processing.
-
Hello Everybody! I need some help in understanding Message Queues when creating an UI thread. I have created a thread that does a lengthy action delivered using SendMessage. Whenever I need the thread to complete this action, a PostThreadMessage is post this request to the thread's message queue. This creates a bottleneck at the queue because more messages are being pumped into the queue then they can be processed! Is there a limit to how many messages that a message queue can hold? Any help with this problem is greatly appreciated! :)
There is no practical limit, that I know of. Are you losing messages? How far behind is the worker thread that receives the messages? If the thread spends a significant amount of time waiting, you have extra cycles available. You could try using more that one thread to relieve the bottle neck.
-
There is no practical limit, that I know of. Are you losing messages? How far behind is the worker thread that receives the messages? If the thread spends a significant amount of time waiting, you have extra cycles available. You could try using more that one thread to relieve the bottle neck.
-
Hi, Actually speaking there is no declared limit for the number of messages. But if the same messages are being sent continuously - you could test by using PeekMessage and remove the trailing messages for each message(the specific kind) you are processing.