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

Remove stdio lock methods #807

Merged

Conversation

KamilaBorowska
Copy link
Contributor

Fixes #805.

Copy link
Member

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sad, but the right thing to do until we have a correct implementation. Thank you

@KamilaBorowska
Copy link
Contributor Author

KamilaBorowska commented Jun 4, 2020

I personally don't think it's possible to have a correct implementation that inter-ops with standard library's locks because of standard library's choice to have a reentrant mutex.

It may be possible to skip the standard library, and directly call C API directly. This should be sound on POSIX platforms (I'm not sure about non-POSIX platforms). Sure, it may lead to garbage reads and writes (https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html says that "The behavior of multiple concurrent reads on the same pipe, FIFO, or terminal device is unspecified") when sync I/O operations and async I/O operations are combined, but strictly speaking that's not unsafe.

@dignifiedquire dignifiedquire merged commit 6ca7b09 into async-rs:master Jun 4, 2020
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.

StdoutLock is unsound
2 participants