Hi,
I'm trying to implement multi thread application using
emscripten_async_call and got next problem.
When I'm trying to call emscripten_async_call twice for different functions
with emscripten_sleep_with_yield() inside I have *Assertion failed:
undefined *exception.
It happens into library_async.js there:
*assert(EmterpreterAsync.state === 2);*It is looks like race condition.
Maybe somebody know how to avoid such problem and emulate async execution
using emscripten_async_call() ?
Could you help please?
See my test where I got this problem into attachment.
I compiled it using
emcc -Oz -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s ASSERTIONS=1 -s
EMTERPRETIFY_WHITELIST='["_second_call", "_first_call"]' --profiling-funcs
-o test.html -I ./../../ recursive_async2.c
emsdk version is latest.
Thanks
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
/*
* Copyright 2014 The Emscripten Authors. All rights reserved.
* Emscripten is available under two separate licenses, the MIT license and the
* University of Illinois/NCSA Open Source License. Both these licenses can be
* found in the LICENSE file.
*/
#include <stdio.h>
#include <emscripten.h>
int times = 0;
void first_call(void* p )
{
for(int i = 0;i<100;i++)
{
printf("first call\r\n");
emscripten_sleep_with_yield(i*5);
}
}
void second_call(void* p )
{
for(int i = 0;i<10;i++)
{
printf("second call\r\n");
emscripten_sleep_with_yield(i*5);
}
}
void main_loop(void) {
static int cnt = 0;
if (++cnt >= 10) emscripten_cancel_main_loop();
}
int main(void) {
emscripten_async_call(second_call, NULL, 20);
emscripten_async_call(first_call, NULL, 10);
times++;
printf("This should only appear once.\n");
emscripten_set_main_loop(main_loop, 10, 0);
return 0;
}