Hi!
Explanation:
I have just started to port one of my hobby games to WASM.
The experience so far has been superb.
Got most of it up and running in a few hours and it is looking really promising.
But after a few minutes/seconds of game play run in to these deadlocks that I just canāt wrap my head around. It is not reported as a deadlock by the runtime and it just freezes my browser. (Same with all major browsers)
Speculation:
The game runs fin on lots of other platforms and have multiple backends so Iām pretty sure this is an issue only in the WASM backend.
Since this deadlock is not reported by the runtime as ādeadlock: all goruntines are asleepā Iām thinking there is some consideration I need to take when calling JS from my WASM code or starting new gorutines.
Question:
If I understand it correctly the āWASM standardā does not support/define os threads? So how are gorutines multiplexed in the runtime? Are there some limitation that I need to consider?
Can the runtime handle two gorutines in a tight loop? (Preemptive multitasking)
This dosnāt seem to work for me. It looks like only one of the tight loops prints to the console.
I have tried both runtime.Gosched() and a select statement (with a default) within the tight loops but only one seems to execute.