| 48 | } |
| 49 | |
| 50 | int 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 | } |