MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / main

Function main

test/module/test_stdin.c:50–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50int main(int argc, char const *argv[]) {
51 fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
52
53 // SM shell doesn't implement an event loop and therefore doesn't support
54 // emscripten_set_main_loop. However, its stdin reads are sync so it
55 // should exit out after calling main_loop once.
56 main_loop();
57
58#ifdef __EMSCRIPTEN__
59 emscripten_set_main_loop(main_loop, 60, 0);
60#else
61 while (1) main_loop(); sleep(1);
62#endif
63 return 0;
64}

Callers

nothing calls this directly

Calls 3

main_loopFunction · 0.70
fcntlFunction · 0.50
sleepFunction · 0.50

Tested by

no test coverage detected