Sleep API is using up 60% CPU time in the DLL 
Author Message
 Sleep API is using up 60% CPU time in the DLL

I created a simple VB COM DLL to monitor the message queue.

While Flag = "1"

Check there is anything stuck in the message queue.
Sleep 50000

Wend

I called the Sleep API function to yield the CPU time to other
process. However, it takes 50%-60% of the CPU time all the time once
this DLL is created and start running. Once I killed the process. The
CPU usage time is back to normal. 98% idle time. I have tried to
increase the Sleep time interval to 5 minutes and it still not seems
solve the problem. I started this DLL from the SQL Job. Is anything
wrong in the Sleep API?

Henry



Mon, 10 May 2004 17:30:18 GMT  
 Sleep API is using up 60% CPU time in the DLL
Why not just use a Timer ?

Once your thread is stuck down in the DLL, there it sits unless you
use DoEvents - and 50,000 milli seconds is 50 seconds which means your
App is frozen for nearly a minute.


Quote:
>I created a simple VB COM DLL to monitor the message queue.

>While Flag = "1"

>Check there is anything stuck in the message queue.
>Sleep 50000

>Wend

>I called the Sleep API function to yield the CPU time to other
>process. However, it takes 50%-60% of the CPU time all the time once
>this DLL is created and start running. Once I killed the process. The
>CPU usage time is back to normal. 98% idle time. I have tried to
>increase the Sleep time interval to 5 minutes and it still not seems
>solve the problem. I started this DLL from the SQL Job. Is anything
>wrong in the Sleep API?

>Henry



Mon, 10 May 2004 20:00:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HOW to wait or sleep to free CPU time

2. Reducing Load on CPU in Access - Sleep API?

3. Why does 24*60*60 = overflow ?

4. 7 * 24 * 60 * 60 = OverFlow !?

5. wscript.sleep uses 100% CPU

6. Design Time Control - 60 Library

7. Sleep() api timing???

8. Calculating time to the millisecond for Sleep() API

9. activeX-dll hangs with 99% cpu-time

10. activeX-dll hangs with 99% cpu-time

11. Using Runtime Access 2000 And Full Ver Access 97 Same CPU Same Time

12. VB Sleep Hangs up CPU

 

 
Powered by phpBB® Forum Software