Message queue overload
-
Hello, I seem to be having a problem with my message queue. I am working on a data aquisition app (multi-threaded). The data aquisition thread(s) post messages to the MFC gui thread when data is received and when the graph needs to be refreshed. Occasionally, the graph stops displaying data until the refresh occurs (rather than as it is received). When this happens, all of the buttons in the dialog become inoperable. Is there a way to do something with the message queue? I'd like to be able to see if it's getting full and, perhaps, increase its size. Thank you. Paul Ebert
-
Hello, I seem to be having a problem with my message queue. I am working on a data aquisition app (multi-threaded). The data aquisition thread(s) post messages to the MFC gui thread when data is received and when the graph needs to be refreshed. Occasionally, the graph stops displaying data until the refresh occurs (rather than as it is received). When this happens, all of the buttons in the dialog become inoperable. Is there a way to do something with the message queue? I'd like to be able to see if it's getting full and, perhaps, increase its size. Thank you. Paul Ebert
Hi. Perhaps you should try to prevent the message queue from getting overload. I assume you don't need more than a few refreshs in a second?! So you can implement a global thread-safe bool which - is set when a message is sent to the GUI. - is reset by the paint reoutine after completion. The threads only send a refresh request, when the bool is not set. Hope it will help you. Karl
-
Hello, I seem to be having a problem with my message queue. I am working on a data aquisition app (multi-threaded). The data aquisition thread(s) post messages to the MFC gui thread when data is received and when the graph needs to be refreshed. Occasionally, the graph stops displaying data until the refresh occurs (rather than as it is received). When this happens, all of the buttons in the dialog become inoperable. Is there a way to do something with the message queue? I'd like to be able to see if it's getting full and, perhaps, increase its size. Thank you. Paul Ebert
In Windows 3.1 there was SetMessageQueue function that made increasing the queue size possible, but it's obsolete now - they probably made it a no-op call. Do you really have to post multiple messages from data acquisition thread? Before posting you could check if GUI is already refreshed. If not, no need for second PostMessage. Tomasz Sowinski -- http://www.shooltz.com.pl