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

Buffer fillup issue with 20+ hz data stream #51

Closed
mikepurvis opened this issue Nov 18, 2013 · 2 comments
Closed

Buffer fillup issue with 20+ hz data stream #51

mikepurvis opened this issue Nov 18, 2013 · 2 comments

Comments

@mikepurvis
Copy link
Contributor

It appears that the call to select/pselect in Linux yields the thread, even when data is immediately available, and it should be a noop. I can't find documentation of this behaviour, but it's very clearly evident by monitoring serial_->available() on a sensor which returns data sentences at 50Hz.

I believe the fix is to prepopulate the read buffer from a ::read call prior to the first select call. This prevents select from ever being invoked if sufficient data is immediately available.

This issue affects both the master branch as well as the timespec refactor. I've added the fix for this in a9bf8d8, on the timespec refactor branch (ref #45). Would prefer not to bother with back-porting it.

@wjwwood
Copy link
Owner

wjwwood commented Nov 19, 2013

The current implementation assumes that select/pselect does not do this, and if it does, then it is not obvious from the documentation.

A quick ::read before calling select/pselect seems like a low risk solution.

@mikepurvis
Copy link
Contributor Author

Okay, we can close this once #45 is merged.

I'm hoping that it may be possible to demonstrate the necessity of this in a test, but who knows.

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

No branches or pull requests

2 participants