emscripten-core / emscripten-core/emscripten
Event Loop Integration: Support for Poll, Epoll or Coroutines
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
I am trying to port Mapbox GL Native (https://github.com/mapbox/mapbox-gl-native) to WASM and final piece is getting event loop to work in emscripten/wasm.
Each thread in mapbox runs its own event loop - blocking on an empty file descriptor. As new events arrives loop is woken up by signalling on the file descriptor.
I asked libuv folks https://github.com/libuv/help/issues/128 if I could get this to work under emscripten and answer was likely no since emscripten does not have real "poll" (see emscripten-core/emscripten#2590) or epoll (emscripten-core/emscripten#5033):
So whats the alternative?
I have tried using emscripten_pause_main_loop - but don't understand how to wakeup/resume main loop via async task once paused. All the sleep and yield functions are gone. ASINCIFY has been removed and fiber.h introduced but there are no high level constructs like coroutines anymore to create embedded event loop yet.
Will epoll or poll supported anytime soon? Will you reintroduce coroutines or provide samples of how to fiber.h to create an event loop like mechanism?
thank you.
Contributor guide
Assessment
This issue has not been assessed yet.