Hello,

Quick question.
A JS function that calls into Go code via a Func wrapper (meaning it was 
defined in Go wasm code) is not allowed to block.

Reason being that its execution blocks the event loop.

Could that be relaxed so that we can cooperatively yield back to javascript?

I am not sure it makes sense but I think I have a use case: I want a 
synchronous wrapper around indexedDB which is an async javascript API.

Originally, the idea was to block in wasm until the indexedDB promise 
resolved and called back into go to unblock the goroutine.
But if I block in wasm, the promise can't resolve because the event loop is 
also blocked and Promises are async and as such require the event loop.
If the promise can't run it can't unblock the goroutine. If the goroutine 
can't be unblocked, then the event loop can't either. DEADLOCK! :s

Any idea? Does it make sense?




-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/da021fbf-4c0f-4cf7-b05f-dc246c7650dan%40googlegroups.com.

Reply via email to