aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-08-15 15:04:07 -0400
committerBrian Cully <bjc@kublai.com>2019-09-02 11:42:29 -0400
commit0654e10d0078955d6917db504ee5947846d4f952 (patch)
tree6420567ff130614dff2185b77d580efa6593cc87 /src/lib.rs
parentf15d28f86333d869b3ef0aaba10f4d720725bce5 (diff)
downloadstarb-0654e10d0078955d6917db504ee5947846d4f952.tar.gz
starb-0654e10d0078955d6917db504ee5947846d4f952.zip
Remove `Sync` marker for Reader/Writer.v0.3.0
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`.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs3
1 files changed, 1 insertions, 2 deletions
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<T> RingBuffer<T> {
(rbr, rbw)
}
}
+unsafe impl<T> Send for RingBuffer<T> 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<T> Send for Reader<'_, T> where T: Send {}
-unsafe impl<T> 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<T> Send for Writer<'_, T> where T: Send {}
-unsafe impl<T> Sync for Writer<'_, T> {}
impl<T> Reader<'_, T> {
/// The number of elements currently available for reading.