Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use select() to avoid burning the CPU when reading from the UARTs #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nviennot
Copy link
Contributor

No description provided.

@virtualabs
Copy link
Owner

I tried to use select() when I was developping Btlejack, but always had a bigger latency and sometimes Btlejack missed some packets ... Anyway, I'll give your version a try and see if it saves my CPU :)

@nviennot
Copy link
Contributor Author

Arguably, the latency should be better with the select() version when using multi devices, because the client will know which devices to read from, as opposed to try them all round robin. So if we have three devices, and only the third device has data to read, then we just return from the select() call, and invoke read() on the right device immediately.

Having said that, I have not benchmarked the latency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants