Can I change the priority of "main"
-
I have a main program that creates some threads, then goes into an event loop. The structure is: main() { CreateThread.... CreateThread..... while(1) { WaitForSingleObject(Main_Event) .... do some processing.... } } I would like to increase the priority of "main" so that when "Main_Event" is sent, the threads suspend while main loop is processing. Any idea how I can do this?
-
I have a main program that creates some threads, then goes into an event loop. The structure is: main() { CreateThread.... CreateThread..... while(1) { WaitForSingleObject(Main_Event) .... do some processing.... } } I would like to increase the priority of "main" so that when "Main_Event" is sent, the threads suspend while main loop is processing. Any idea how I can do this?
The main thread could use SuspendThread() to suspend the other threads when the Main_Event is signaled. Another possibly safer design is to make the threads able to stop themselves when signaled somehow and wait for an event that lets them resume. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: