when using RestClientEmscripten, and especially ContextClient with a Rest client, we stumble into a couple of problems.
emscripten_fetch is an asynchronous function
making it synchronous - disturbs the program flow/especially on bigger files
architectural: use main as initialisation and have a main_loop(), repeatedly called by emscripten and proxy your fetch calls to the main thread
threading: creating a new thread that spawns the fetch and exits, thereby exiting to js runtime and alowing the fetch and the load to happen
proxying fetch calls to the main thread will require storing callbacks.
with threading, dangling threads tend to happen, also there is some buggy behaviour on exit, when deserialise gets called inside the callback. this might be related to a static variable in IoBuffer or a (missing) inline.
when using RestClientEmscripten, and especially ContextClient with a Rest client, we stumble into a couple of problems.
emscripten_fetch is an asynchronous function
proxying fetch calls to the main thread will require storing callbacks.
with threading, dangling threads tend to happen, also there is some buggy behaviour on exit, when
deserialise
gets called inside the callback. this might be related to a static variable in IoBuffer or a (missing) inline.https://github.com/emscripten-core/emscripten/issues/16305