Thanks - I was looking for alternatives to sleep, since I'm blocked on this:

    https://github.com/kripken/emscripten/issues/2663

On Thursday, 9 October 2014 14:28:26 UTC+2, 王璐 wrote:
>
> Not exactly.
> The coroutine created by emscripten API must be "stepped" using 
> emscipten_coroutine_next (cannot remember the exact name), so probably one 
> possible way is to write like this:
>
> int main_loop_coroutine(...) {
>    ...
>    emscripten_yield();
> }
>
> int main() {
>   auto co = emscripten_coroutine_create(...)
>   while(emscripten_coroutine_next(co) {
>      emscripten_sleep(1);
>   }
>   return 0;
> }
>
> But an easier way is to write "while(1) { do_something(); sleep(1); }" 
> instead of coroutines.
>
>
> regards,
> - Lu
>
> On Thursday, October 9, 2014 6:00:50 PM UTC+8, Woof wrote:
>>
>> I see that coroutine support has been added in the new 1.25.0 release but 
>> I can't find any examples or documentation. If I implement my main loop as 
>> a coroutine, will calling emscripten_yield() allow the browser to service 
>> events?
>>
>

-- 
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.

Reply via email to