Async semaphore from wasm_bindgen_futures and futures_*?

If all I am using is wasm_bindgen_futures* ans futures_*, what is the easiest way to get a semaphore ? Basically, I want a "cell" where:

  1. one async task is waiting for someone to put a value in the cell, and start execution after getting a value

  2. a second async task which can put value into the cell

  3. cell needs to be re-useable

I think you're describing an async channel. You can use the ones in futures::channel even in wasm32-unknown-unknown. futures::channel::oneshot isn't reusable unless the sender also sends a new oneshot channel along with the data.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.