Commit 27dfd86
committed
bugfix(web): Yield to the browser event loop at the multiplayer load barrier
startNewGame waits for every player's "load complete" message in a
while(!isProgressComplete()) Sleep(100) loop. In a browser those messages arrive
through WebSocket callbacks that only run when control returns to the event loop,
which Sleep() never does, so starting a multiplayer match hung here forever.
Call emscripten_sleep() instead on Emscripten, which yields cooperatively. The
link already enables the ASYNCIFY this needs - its flag was carried over without
the call site that motivated it.1 parent 53da6ba commit 27dfd86
1 file changed
Lines changed: 14 additions & 0 deletions
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
2627 | 2631 | | |
2628 | 2632 | | |
2629 | 2633 | | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
2630 | 2643 | | |
| 2644 | + | |
2631 | 2645 | | |
2632 | 2646 | | |
2633 | 2647 | | |
| |||
0 commit comments