Code comment on *mut Stream effect on thread safety

This commit is contained in:
Martin Algesten
2019-10-20 14:06:24 +02:00
parent 8871183df0
commit d9b8fef9a0
2 changed files with 6 additions and 1 deletions

View File

@@ -77,7 +77,10 @@ impl PoolKey {
pub(crate) struct PoolReturnRead<R: Read + Sized> {
// unit that contains the agent where we want to return the reader.
unit: Option<Unit>,
// pointer to underlying stream
// pointer to underlying stream.
// this pointer forces the entire PoolReturnRead to be !Sync and !Send
// that's a good thing, because the pool return logic is certainly not
// thread safe.
stream: *mut Stream,
// wrapped reader around the same stream
reader: Option<R>,