Alternative to Sleep(0)?
-
While using Sleep(0), I've noticed lag when the process context is switched to the next application. It seems almost as if Sleep(0) is causing the processor to thrash between apps. Maybe I'm just :~. I was wondering if any of you have noticed something similar? Also, other than thread priority is there a way to relinquish thread control? Just as an afterthought. For a while I ran the United Devices Cure for Cancer app. I noticed that it kept the CPU pegged but I was never able to tell when the process context switched. I wonder what they used. nay
-
While using Sleep(0), I've noticed lag when the process context is switched to the next application. It seems almost as if Sleep(0) is causing the processor to thrash between apps. Maybe I'm just :~. I was wondering if any of you have noticed something similar? Also, other than thread priority is there a way to relinquish thread control? Just as an afterthought. For a while I ran the United Devices Cure for Cancer app. I noticed that it kept the CPU pegged but I was never able to tell when the process context switched. I wonder what they used. nay
-
Why are you using Sleep(0)? Why do you feel the need to stall the thread? Tim Smith I'm going to patent thought. I have yet to see any prior art.
-
Other applications are running concurrently. I do not want one to "hog" resources. From the MSDN Sleep(0) is what I want, but I'm not satisfied with the performance of it. I was just curious if there was another solution. nay
If you have one thread that just wants to peg CPU, use Sleep(50); ... Sleep(200);
-
Other applications are running concurrently. I do not want one to "hog" resources. From the MSDN Sleep(0) is what I want, but I'm not satisfied with the performance of it. I was just curious if there was another solution. nay
Windows is a preemptive multi-tasker. It will periodically suspend your process to allow other things to run. If that isn't good enough for the thread in question, then force the priority of the thread to a lower level. Thus, if the use tries to work with practically any other window, they will be responsive. There just isn't any justification for using Sleep on a real multi-tasking operating system. It causes excessive kernel transitions to do something that the OS is already designed to do for you. Tim Smith I'm going to patent thought. I have yet to see any prior art.