Add in (unsafe and incorrect) impls of Send/Sync that are now required.

This commit is contained in:
Richard Dodd
2019-07-06 16:30:29 +01:00
parent 7fe3dfd4f5
commit 2541507789
5 changed files with 16 additions and 18 deletions

View File

@ -26,8 +26,8 @@ use wasm_bindgen::prelude::*;
pub struct JsFuture {
resolved: oneshot::Receiver<JsValue>,
rejected: oneshot::Receiver<JsValue>,
_cb_resolve: Closure<FnMut(JsValue)>,
_cb_reject: Closure<FnMut(JsValue)>,
_cb_resolve: Closure<dyn FnMut(JsValue)>,
_cb_reject: Closure<dyn FnMut(JsValue)>,
}
impl fmt::Debug for JsFuture {
@ -143,6 +143,10 @@ where
is_queued: Cell<bool>,
}
// TODO This is only safe because JS is currently single-threaded
unsafe impl Send for Task {}
unsafe impl Sync for Task {}
impl Task {
#[inline]
fn new<F>(future: F) -> Arc<Self>