Page 1 of 1

read() with or without select()?

Posted: Mon Jul 12, 2010 7:49 pm
by ckoehler
Hi,

From the docs, it looks like read() blocks the task. We're having some trouble speeding up the read over serial and were wondering if sticking it inside a select() conditional would speed the whole thing up. Just intuitively, it shouldn't be faster, right? read() blocks until it sees data, which is fine for me since it's a separate task that doesn't need to run until it finds data on the port. Seems like select() would do the same thing, just tell me when there's data so I can read() it.

Is that about right?

Thanks!

Christoph

Re: read() with or without select()?

Posted: Tue Jul 13, 2010 9:18 am
by pbreed
read is your best choice.
What speed problems are you having?

What baud rate are you running and what speed issues are you having?
How are you measuring this?

Remember that if you ask read to read 10 chars, and there is only 1 available, it will return with 1, not wait for 10.

Re: read() with or without select()?

Posted: Tue Jul 13, 2010 9:57 am
by ckoehler
Thanks, I made a different thread for the speed problems, and you replied in it, so I will address that there. Thanks for the tip on read() only.