MCPcopy Create free account
hub / github.com/buke/quickjs-go / js_std_loop

Function js_std_loop

deps/quickjs/quickjs-libc.c:4830–4855  ·  view source on GitHub ↗

main loop which calls the user JS callbacks */

Source from the content-addressed store, hash-verified

4828
4829/* main loop which calls the user JS callbacks */
4830int js_std_loop(JSContext *ctx)
4831{
4832 JSRuntime *rt = JS_GetRuntime(ctx);
4833 JSThreadState *ts = js_get_thread_state(rt);
4834 JSContext *ctx1;
4835 int err;
4836
4837 for(;;) {
4838 /* execute the pending jobs */
4839 for(;;) {
4840 err = JS_ExecutePendingJob(JS_GetRuntime(ctx), &ctx1);
4841 if (err <= 0) {
4842 if (err < 0)
4843 goto done;
4844 break;
4845 }
4846 }
4847
4848 js_std_promise_rejection_check(ctx);
4849
4850 if (!ts->can_js_os_poll || js_os_poll(ctx))
4851 break;
4852 }
4853done:
4854 return JS_HasException(ctx);
4855}
4856
4857int js_std_loop_once(JSContext *ctx)
4858{

Callers 7

worker_funcFunction · 0.85
eval_bufFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 3

js_get_thread_stateFunction · 0.85
js_os_pollFunction · 0.85

Tested by 2

eval_bufFunction · 0.68
mainFunction · 0.68