Best way to fix a blocked message pump in MFC
Posted on 2007-10-15
I have a client server app. The client sends out a heartbeat message at user determined intervals. The problem is that at other preprogrammed times the client can go into a self test mode. Unfortunately the self test mode was written such that the windows message pump gets blocked...The server then misses its expected heartbeat messages and takes control (this is a hot standby system). I am thinking of 2 possible soulutions to this probem:
1) Add "run the message pump" code in all places where the message pump could be blocked.
2) Put the "send heartbeat" function in a thread. I like this idea the best. My question is:
Which do you guys think is the best approach?
If the thread is the best approach, how do I put a "timed" event in a thread ? ie the heartbeat thread runs continously but I only need to send the message once every n seconds.
Thanks in advance,