Skip to content
Discussion options

You must be logged in to vote

Wrapping an IO resource in a mutex or rwlock is almost wrong. You are deadlocking because the reader and the writer are blocking each other. You should split your IO resource instead. For the specific case of TcpStream, you can use the TcpStream::into_split method to get a read and write half that can be used independently.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@OverShifted
Comment options

Answer selected by OverShifted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants