Today I learned about the possibility of running synchronous code in a web 
worker, via --proxy-to-worker. A simple SDL 2 example which displays 
animation worked with emscripten_set_main_loop() replaced by an infinite 
loop. However, two problems make this impractical. I just want to make sure 
these are still unavoidable JavaScript limitations.

There seems to be no way to get events when running in an infinite loop, so 
there is no way to get input. If you want input, you have to regularly 
return to the browser event loop, just as if you were not running in a 
worker, and you won't be able to avoid using Emterpreter-Async or Asyncify.

There also seems to be no way to sleep, so you have to busy wait instead. A 
function which schedules another function to run at a later time cannot be 
used as a general replacement for a function which waits and returns. So, 
you again run into the same limitations as when not running in a worker.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to