Windows threads

Apr 11, 2012 at 3:21pm
Im looking for a way to safely pause and resume threads. What I want to do is emulate how windows allots processor time for threads. aka "you can go"..."now stop", (another thread) "you can go"..."now stop". I've tried using SuspendThread, and ResumeThread, but it causes problems. I want a way to monitor the threads, and when its safe, halt its execution. This is for a GUI project. Since I will only do rendering from one thread (main thread) and since it will be running "Processes", I don't want to have to worry about writing "Processes" that give up priority.(there is going to be alot of processes). Kinda like how windows 3.1 needed applications to give up control of processor time or the whole system would stall. I know I have the concept, but i cannot think of how i can do this. If you have any pointers, or any sites that i can read, that would be great.
Apr 11, 2012 at 9:12pm
I imagine that what you want to code cannot be coded in regular user mode. I recommend that you ask this question in a forum dedicated to kernel mode windows programming, such as a drivers forum or similar.
Apr 11, 2012 at 11:35pm
I think im just going to use mutex's to pause a thread... much easier and probably more reliable. just capture the mutex at the beginning of the "main loop" in a process, then waitforsingleitem. but I'll ask anyways. It just seemed like a cool thing to try and do.
Apr 12, 2012 at 4:48am
Mutexes or any other synchronization object like events are good, yes, but they only work if the threads are yours. It was my understanding you were messing with threads from other processes. If you are the one programming the threads, then yes, by all means use synchronization objects and only resort to kernel mode programming if you intend to meddle with threads not written by you.
Topic archived. No new replies allowed.