multi-threading and the hGLRC

i’m multithreading an engine and putting the rendering thread in a thread seprate from the OS thread.

well, when, say, the user resizes the window, or goes full screen, the rendering thread must update the RC accordingly.

problem is, the thread that knows to change the RC is a different thread…

my idea is just to use boolean flags and test the current state each loop in the rendering thread, but that makes it a FSM and is an ad-hoc method to me.

i just wanted to know how if any of you guys have had similar design problems, and see if you have any succinct ways of accomplishing this.

thank you for your bandwidth

[This message has been edited by Succinct (edited 02-05-2001).]

MSDN:
“Create an event object, then create the rendering thread. Use the WaitForSingleObject in rendering thread function to wait for the event to be set to the signaled state before calling PostThreadMessage in WNDPROC or other thread. In the rendering thread to which the message will be posted, call PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE)to force the system to create the message queue. Set the event, to indicate that the thread is ready to receive posted messages.”

Or you can try with CriticalSections.Create your own custom message queue and after rendering thread finish, do EnterCriticalSection, process messages and then LeaveCritcalSection.To post a message to the rendering thread :
EnterCriticalSection, add message to queue and LeaveCriticalSection.