How do I enqueue_microtask from other thread
so
Isolate.enqueue_microtask is obviously not send/sync so I think the only option is to use std::sync::mpsc::channel and use Receiver.try_recv to get the values from Sender on other thread. The problem is that I am being a rust newbie don't know how to combine them on the single thread or if it actually possible. I somehow need to wake up the runtime when the Sender actually sends the value, I think I can wrap try_recv with poll_fn and use something like tokio's select! macro but that also doesn't seem to fit my problem because I need to be able to restart run_event_loop to process any new microtasks. Any pointers?5 Replies
the easiest way is probably to have an op that listens for mpsc messages
the op would resolve when the message arrives, and return the passed value to JS
and then on an extension script, you would call that op on an async loop
cool, that looks like it could actually work. thanks for the help
that loop would keep the event loop alive
if you don't want that, you can do
similar to how
Deno.unrefTimer workshow is it better/worse?
oh it doesn't block the event loop from stopping
right