Is it possible to put message pump into a separate thread?

Started by
2 comments, last by MJP 15 years, 8 months ago
A quickie question; Is it possible to put message pump into a separate thread? The usual method seems to be putting the message pump in main program and the game in threads, but in my prototype's case it would be convinient to do things the other way around. However, just moving message pump into a thread didn't seem to work, so is there some detail I should be aware of? Thanks for the help :D
Advertisement
Message queues are per thread so you need to create the window in the same thread as you intend to do the pump. As long as you do that you should be fine.
Also note that if you're using D3D, then all D3D access should be done from the thread that handles the window messages. If you absolutely must, then use the multithreaded flag, but some functions still need to be called from the message pump thread.

Then again, if you're not using D3D, never mind [smile]
You have to be careful when doing this, as Windows have thread affinity.

This topic is closed to new replies.

Advertisement