read() with or without select()?

Discussion to talk about software related topics only.
Post Reply
ckoehler
Posts: 81
Joined: Sat Mar 13, 2010 9:04 pm

read() with or without select()?

Post 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
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

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

Post 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.
ckoehler
Posts: 81
Joined: Sat Mar 13, 2010 9:04 pm

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

Post 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.
Post Reply