Re: Thread Priority
- From: "Kevin Urben" <me@xxxxxxxxxxxx>
- Date: Fri, 27 Jun 2008 16:21:14 +0100
Ah - it's that Sleep() function again !
Calling Sleep(20) in the polling loop calms everything down !
And I can still respond to a pulse >20ms on the I/O line.
Is that the recommended way ? Seems to work fine ...
"Kevin Urben" <me@xxxxxxxxxxxx> wrote in message
news:02bb100d$0$8028$c3e8da3@xxxxxxxxxxxxxxxxxxxx
Hi,
I am running a thread to monitor the state of an I/O line on a NI PCI 6503
Digital I/O board.
The thread reads the port continuously and waits for a change on the line.
When detected, it fires off a message to the app. message queue to start a
measurement.
It all works fine, except that the thread consumes all the CPU cycles on
one
core when nothing else is happening ! Maybe I shouldn't worry, but on a
laptop that causes the CPU to max out and waste power. I could lower the
thread priority - not sure what that would do. In truth, I probably only
need to read the port 20 times per second. Any suggestions ? Would a timer
be better ?
Thanks for reading !
Kevin
.
- Follow-Ups:
- Re: Thread Priority
- From: Maarten Wiltink
- Re: Thread Priority
- References:
- Thread Priority
- From: Kevin Urben
- Thread Priority
- Prev by Date: Thread Priority
- Next by Date: Re: Thread Priority
- Previous by thread: Thread Priority
- Next by thread: Re: Thread Priority
- Index(es):
Relevant Pages
|