From 0654e10d0078955d6917db504ee5947846d4f952 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Thu, 15 Aug 2019 15:04:07 -0400 Subject: Remove `Sync` marker for Reader/Writer. These are not sync, as they can only be used from one thread at a time. Also add a `Send` trait for `RingBuffer`, as long as its element type is also `Send`. --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 254d833..96a947b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,6 +73,7 @@ impl RingBuffer { (rbr, rbw) } } +unsafe impl Send for RingBuffer where T: Send {} /// Consumer of `RingBuffer`. pub struct Reader<'a, T> { @@ -80,7 +81,6 @@ pub struct Reader<'a, T> { _marker: PhantomData<&'a ()>, } unsafe impl Send for Reader<'_, T> where T: Send {} -unsafe impl Sync for Reader<'_, T> {} /// Producer for `Ringbuffer`. pub struct Writer<'a, T> { @@ -88,7 +88,6 @@ pub struct Writer<'a, T> { _marker: PhantomData<&'a ()>, } unsafe impl Send for Writer<'_, T> where T: Send {} -unsafe impl Sync for Writer<'_, T> {} impl Reader<'_, T> { /// The number of elements currently available for reading. -- cgit v1.2.3