emscripten-core / emscripten-core/emscripten

add asyncify into gl_in_pthread.cpp

Open
#12,572 2 comments 0 reactions 0 assignees View on GitHub
asyncify
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

So the gl_in_pthread.cpp never worked for me. it would always SNAP instantly to red instead of fade to red. It was only recently when I examined gl_in_proxy_pthread.cpp did I realize why. calls like this

while(emscripten_get_now() - now < 16) /*no-op*/;

were basically blocking the opengl updates from occuring? at least i think that's the reason. In order to fix this example for me you would only need to add the asyncify reference similar to the gl_in_proxy_pthread.cpp example... so

replace on line 55
double now = emscripten_get_now();
while(emscripten_get_now() - now < 16) /*no-op*/;

with this.
#if ASYNCIFY
emscripten_sleep(16);
#else
double now = emscripten_get_now();
while(emscripten_get_now() - now < 16) /*no-op*/;
#endif

and of course add the appropriate asyncify options to the test_browser.py .
-s ASYNCIFY -DASYNCIFY
somewhere....

This would fix the example for me and maybe help others?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.