From c5bf36b0e3e1aea41e95b43ec3434134d40d6d27 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio <jorge@japaric.io> Date: Thu, 27 Jul 2017 21:17:04 -0500 Subject: [PATCH] resource data must be Send --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 737afad..3f1878f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ pub use static_ref::Static; /// A resource, a mechanism to share data between tasks pub unsafe trait Resource { /// The data protected by the resource - type Data; + type Data: Send; /// Borrows the resource data for the duration of a critical section /// @@ -50,7 +50,10 @@ pub unsafe trait Resource { F: FnOnce(&mut Static<Self::Data>, &mut Threshold) -> R; } -unsafe impl<T> Resource for Static<T> { +unsafe impl<T> Resource for Static<T> +where + T: Send, +{ type Data = T; fn borrow<'cs>(&'cs self, _cs: &'cs Threshold) -> &'cs Static<T> { -- GitLab