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

Port.Flush() sets file descriptor to blocking mode in linux #92

Open
elliotmr opened this issue Nov 8, 2018 · 1 comment
Open

Port.Flush() sets file descriptor to blocking mode in linux #92

elliotmr opened this issue Nov 8, 2018 · 1 comment

Comments

@elliotmr
Copy link

elliotmr commented Nov 8, 2018

the call to p.f.Fd() inside the Port.Flush() sets the file descriptor to blocking mode. Either we should save a reference to the file descriptor in the object field or set the fd back to non-blocking mode after flush is complete.

elliotmr added a commit to elliotmr/serial that referenced this issue Nov 8, 2018
@elliotmr
Copy link
Author

elliotmr commented Nov 8, 2018

Holy smokes, I just saw that it is specifically setting the file descriptor to be blocking instead of blocking. Is there a specific reason for this?

Just for a little more context, since Go 1.11, if you open an os.File in non-blocking mode, it will add it to the runtime poller and you won't have to sit with a blocked os thread when you call read. This has the added benefit of allowing a concurrent close to the port and it then kicking you out of an active read.

elliotmr added a commit to elliotmr/serial that referenced this issue Nov 8, 2018
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

1 participant