Hello,
Can anyone tell me how I can read from the serial port without the read
function blocking, or if it does, it only blocks for a very short time? The
1/10th of a second available in readcond() is still too slow. I need to get
it up to a rate of approximately 100Hz (0.01sec). Alternatively, do I need
to have another process or thread continually waking up the blocked read
function?
Thanks for your help.
Shayne
Shayne Powell wrote:
Hello,
Can anyone tell me how I can read from the serial port without the read
function blocking, or if it does, it only blocks for a very short time? The
1/10th of a second available in readcond() is still too slow. I need to get
it up to a rate of approximately 100Hz (0.01sec). Alternatively, do I need
to have another process or thread continually waking up the blocked read
function?
Have your tried opening the port non-block (see docs for open, flag O_NONBLOCK).
I have never needed to do this, but I have always assumed it would work if I did.
Rennie
Shayne Powell <s2.powell@qut.edu.au> wrote:
Hello,
Can anyone tell me how I can read from the serial port without the read
function blocking, or if it does, it only blocks for a very short time? The
1/10th of a second available in readcond() is still too slow. I need to get
it up to a rate of approximately 100Hz (0.01sec). Alternatively, do I need
to have another process or thread continually waking up the blocked read
function?
Open with O_NONBLOCK, then use either select() or io_notify() to get
notification when there is data available to read() (rather than polling).
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.