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

Makes serialposix.Serial.write() respect non-blocking #97

Merged
merged 1 commit into from Mar 26, 2016

Conversation

rob-smallshire
Copy link
Contributor

The pySerial documentation states that a write_timeout setting of zero should result in non-blocking write() behaviour. This pull-request modifies serialposix.Serial.write() to respect that requirement, by distinguishing between zero and non-zero numeric timeouts. In the zero timeout case, the underlying write() call is made and then the function immediately returns the number of bytes written, which may not be all of the data which which was passed to write.

The previous version of the code would iterate, using select(), until all data had been written, effectively blocking from the clients point of view. True non-blocking writes are essential for a high-quality asyncio serial implementation.

@zsquareplusc zsquareplusc merged commit 12e65a6 into pyserial:master Mar 26, 2016
@zsquareplusc
Copy link
Member

Thank you for all these nicely formatted pull requests.

@rob-smallshire rob-smallshire deleted the non_blocking_write branch March 27, 2016 08:43
@rob-smallshire
Copy link
Contributor Author

@zsquareplusc You're welcome. I have some more asyncio changes in the works to complete the details in the transport to provide async buffered writing.

mr-loading pushed a commit to mr-loading/pyserial that referenced this pull request Mar 12, 2024
* Updated dependencies and go version to 1.18
* Updated go to v1.18 in github workflow files
* Upgraded spf13/cobra to v1.5.0
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