Sender, ReceiverとSend, Sync
SenderがSyncじゃないのはなんで?
- そういうものとして実装している…
- 内部のカウンタは全部atomic
flumeでは両方Sync. なんで?
// The send port can be sent from place to place, so long as it
// is not used to send non-sendable things.
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Send> Send for Sender<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> !Sync for Sender<T> {}
// The receiver port can be sent from place to place, so long as it
// is not used to receive non-sendable things.
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Send> Send for Receiver<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> !Sync for Receiver<T> {}
Backlinks
There are no notes linking to this note.