Hello!
I'm hoping someone has already run into this before and can tell me what
I'm doing wrong...
I have a JavaScript function I'm calling from a C++ multi-threaded game
that is designed to perform an async HTTP fetch.
I'm building the game using USE_PTHREADS=1 and PROXY_TO_PTHREAD=1 and I've
e events otherwise.
>
> To do that, you can use Asyncify (
> https://emscripten.org/docs/porting/asyncify.html) and
> emscripten_sleep(). Or, you can manually return to the main event loop
> yourself, replacing an infinite event loop with an
> emscripten_set_main_loop() etc.
>
Ah! Thanks for the details! I looked into Asyncify and ruled it out
because of this from the emscripten documentation:
It is not safe to start an async operation while another is already
> running. The first must complete before the second begins.
That would mean one HTTP request at a ti
know if the same functionality exists in the JS
> browser...
> You're not supposed to have to worry about such details, but in a thread,
> if I didn't also call the runmicrotasks sort of thing, the promises
> resolved never got dispatched.
>
> On Wed, Mar 25, 2020 at 5:52 P
yer yourself to multiplex them, etc.). But if you
> can just switch to using emscripten_set_main_loop() or some other async way
> of doing your main loop, that would be much simpler and much better.
>
>
>
> On Wed, Mar 25, 2020 at 5:51 PM Kevin McGrath > wrote:
>
>>
THREAD
> (which means that the C main() function runs in a pthread), and a bunch of
> other tests cover other async operations.
>
> It is possible you've found an unknown bug. If so please reduce it to a
> small testcase and submit that.
>
> - Alon
>
>
> On Thu