Skip to content

TimeoutFuture isn't Send. #109

Closed
Closed

Description

@expenses

A TimeoutFuture isn't Send because a wasm_bindgen::JsValue isn't Send. Send is required for a lot of Future Spawners: https://docs.rs/futures/0.3.1/futures/task/trait.SpawnExt.html#method.spawn.

I'm not sure what the right fix for this is. This might be a situation where it's safe-enough to unsafe impl Send.

Activity

  1. added
    bug
    on Jan 15, 2020
  2. Pauan commented on Jan 18, 2020

    @Pauan
    Contributor

    You cannot use normal Future Spawners with wasm (this is because wasm currently does not support threads). Instead, you should use the spawn_local function in the wasm-bindgen-futures crate (or just use an async main function with #[wasm_bindgen]).

    As for the more general problem of impling Send, that will likely never happen, because JS values fundamentally cannot be sent between threads (even when wasm eventually gets threads).

    I've thought about implementing something similar to send_wrapper (thanks for the link), but that will have to wait until we have hands-on experience with wasm threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions