|
-
January 5th, 2009, 03:30 PM
#1
while loop w/ sleep(1) doesnt work
I am writing a software that periodically checks for CAN messages through calls to the driver libraries. And I must perform actions depending on the CAN messages I see.
At first I used a system timer and function call in response to the windows message WM_TIMER.
(i.e. SetTimer(1,10,NULL) and OnTimer() function where the processing of the messages occur.)
But that solution has proven to be too slow, and I need a faster loop. So I though to use a while loop with a sleep of 1ms so as not to lock up the cpu. However, I've read that the sleep interval can only be as low as 15ms, and anything below that will sleep for 15ms.
How can I create a faster loop without using all cpu resources?
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
|