Hi there, I recently launched my first project using pthread in the browser, and I'm now trying to better understand how it actually works under the hood.
One thing I’m particularly curious about is how pthread handles messages from the main thread or other workers. For example, if a pthread-created thread runs a loop like this: while (true) { > // perform some logic > // process events > // respond > sleep(5); > } >From what I understand, this setup shouldn't work without asyncify, since the infinite loop would block the worker and prevent it from handling incoming messages. However, I’ve seen this kind of pattern in a game project, and it seems to work just fine. Am I missing something? Is it possible to run an infinite loop inside a worker and still receive messages from other threads? My guess is that this might work using SharedArrayBuffer, since it's always in sync and doesn’t rely on the worker’s message queue. But is it considered normal for a worker to be in an infinite loop and never respond to messages? Last thing, can pthread-woreker use asyncify? I’d really appreciate any insights on this! Thanks a lot, Alex -- 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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVEkCNX0NyHfgzy7c%2BG84or9ocySG%2BfcZ-Tasz3fZt42xA%40mail.gmail.com.