diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-18 17:46:30 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-18 17:56:13 -0800 |
commit | 133b7ebbdd39cfa04231d39e84ee178db9dd527b (patch) | |
tree | ba2d148890b471b851d6bb5d3607c350007ffddb /tests | |
parent | 9a864d50be044455bcb7626898e58abc406215d9 (diff) |
add a version of emscripten_set_main_loop where the main loop takes an argument; fixes #2114
Diffstat (limited to 'tests')
-rw-r--r-- | tests/emscripten_api_browser.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/emscripten_api_browser.cpp b/tests/emscripten_api_browser.cpp index 18046ca3..a03b71ed 100644 --- a/tests/emscripten_api_browser.cpp +++ b/tests/emscripten_api_browser.cpp @@ -31,6 +31,18 @@ void five(void *arg) { emscripten_resume_main_loop(); } +void argey(void* arg) { + static int counter = 0; + assert((int)arg == 17); + counter++; + printf("argey: %d\n", counter); + if (counter == 5) { + emscripten_cancel_main_loop(); + int result = 1; + REPORT_RESULT(); + } +} + void mainey() { static int counter = 0; printf("mainey: %d\n", counter++); @@ -45,8 +57,8 @@ void mainey() { assert(pre1ed); assert(pre2ed); printf("Good!\n"); - int result = 1; - REPORT_RESULT(); + emscripten_cancel_main_loop(); + emscripten_set_main_loop_arg(argey, (void*)17, 0, 0); } } |