You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Forgive me if I’ve missed something, but I can’t seem to work out how it would be possible call a js callback from rust multiple times from multiple threads. Picture a scenario such as calling an event handler for a stream of events.
Obviously I understand that the is runtime itself has single threaded isolation for the most part so and so the use of cx.channel() to synchronise an async event from another thread makes sense.
However I can’t seem to work out how (assuming it’s possible) to clone argument handles in a separate thread because cx is obviously not Sync.
The only way I can think of doing what I’m trying to do (without using unsafe pointers - which might be my only other option, or making the callback global - which is not ideal or manageable) would be keep attaching a new listener from js each time the callback is called, but this seems inefficient as I would also need to manage a queue of events which the cx channel would otherwise be able to handle.
Please let me know if maybe I’ve missed something in the api docs or if you need more context to clarify anything
The text was updated successfully, but these errors were encountered:
Hi, Forgive me if I’ve missed something, but I can’t seem to work out how it would be possible call a js callback from rust multiple times from multiple threads. Picture a scenario such as calling an event handler for a stream of events.
Obviously I understand that the is runtime itself has single threaded isolation for the most part so and so the use of
cx.channel()
to synchronise an async event from another thread makes sense.However I can’t seem to work out how (assuming it’s possible) to clone argument handles in a separate thread because cx is obviously not Sync.
The only way I can think of doing what I’m trying to do (without using unsafe pointers - which might be my only other option, or making the callback global - which is not ideal or manageable) would be keep attaching a new listener from js each time the callback is called, but this seems inefficient as I would also need to manage a queue of events which the cx channel would otherwise be able to handle.
Please let me know if maybe I’ve missed something in the api docs or if you need more context to clarify anything
The text was updated successfully, but these errors were encountered: