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

Locking for stdin #334

Merged
merged 16 commits into from
Nov 2, 2019
Merged

Locking for stdin #334

merged 16 commits into from
Nov 2, 2019

Conversation

k-nasa
Copy link
Member

@k-nasa k-nasa commented Oct 15, 2019

Implement

  • Stdin::lock
  • Stdout::lock
  • Stderr::lock

ref: #229

Copy link
Contributor

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

Heh, this is very clever and I like it. Thanks!

@yoshuawuyts yoshuawuyts added the enhancement New feature or request label Oct 15, 2019
@ghost
Copy link

ghost commented Oct 15, 2019

Thanks for the PR! I think we should make async versions of StdinLock, StdoutLock, and StderrLock. If we lock an async I/O handle, we should also get back an async I/O handle.

Also, methods like std::io::StdinLock::lock() are blocking operations, so we should perhaps spawn a blocking task that acquires the lock.

src/io/stdin.rs Show resolved Hide resolved
src/io/stdin.rs Outdated Show resolved Hide resolved
@k-nasa k-nasa force-pushed the add_stdin_lock branch 2 times, most recently from 26ec493 to 25ad113 Compare October 27, 2019 12:50
Copy link
Contributor

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

The unimplemented!() calls need to be replaced with delegation to inner types. Thanks!

src/io/stdout.rs Show resolved Hide resolved
src/io/stdin.rs Outdated Show resolved Hide resolved
@k-nasa
Copy link
Member Author

k-nasa commented Oct 29, 2019

Yh!
However, I am a little worried about what to implement.
please wait a moment.

@yoshuawuyts
Copy link
Contributor

@k-nasa this is looking really good! I think all that's left from here is run cargo fmt + add doc tests. Very excited this is moving forward; feels like we're close!

@k-nasa k-nasa closed this Oct 30, 2019
@k-nasa k-nasa deleted the add_stdin_lock branch October 30, 2019 00:09
@k-nasa k-nasa restored the add_stdin_lock branch October 30, 2019 00:25
@k-nasa k-nasa reopened this Oct 30, 2019
@k-nasa
Copy link
Member Author

k-nasa commented Oct 30, 2019

Oh. I accidentally erased the branch...

@k-nasa
Copy link
Member Author

k-nasa commented Oct 30, 2019

It is probably CI upset that CI will fail.
I believe this PR will be solved.
#414

@yoshuawuyts
Copy link
Contributor

@k-nasa merged the branch you linked!

@k-nasa k-nasa requested a review from yoshuawuyts November 1, 2019 16:54
Copy link
Contributor

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

Looks great, thanks heaps!

@yoshuawuyts yoshuawuyts merged commit 4c63392 into async-rs:master Nov 2, 2019
This was referenced Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants