|
-
July 6th, 2006, 04:34 AM
#1
Worker thread -> 99% cpu usage..
Hi,
I have a dedicated thread in my program that always polls the parallel port in 1ms intervalls. The problem is that I have it in a continuous while-loop and the cpu usage is going to 99%.
I tried inserting a "sleep(x)" with x being anything between 0-5, but the problem is that sleep uses the system timer and that has a 15ms resolution, so even a sleep(0) can wait up to 15 milliseconds. I used the Performance Counter to verify that.
Is there a way to prevent the thread from hogging all the cpu ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|