MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

flags for crypto, server, etc

+10 -9
+4 -2
include/runtime.h
··· 3 3 4 4 #include "ant.h" 5 5 6 + #define ANT_RUNTIME_CRYPTO_INIT (1u << 0) 7 + #define ANT_RUNTIME_EXT_EVENT_LOOP (1u << 1) 8 + 6 9 struct ant_runtime { 7 10 struct js *js; 8 11 char **argv; 9 12 jsval_t ant_obj; 10 13 int argc; 11 - int crypto_initialized; 12 - int external_event_loop_active; 14 + unsigned int flags; 13 15 }; 14 16 15 17 extern struct ant_runtime *const rt;
+1 -1
meson.build
··· 74 74 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 75 75 76 76 version_conf = configuration_data() 77 - version_conf.set('ANT_VERSION', '0.1.0.30') 77 + version_conf.set('ANT_VERSION', '0.1.0.31') 78 78 version_conf.set('ANT_GIT_HASH', git_hash) 79 79 version_conf.set('ANT_BUILD_DATE', build_date) 80 80
+1 -1
src/modules/fetch.c
··· 321 321 } 322 322 323 323 void fetch_poll_events(void) { 324 - if (fetch_loop && fetch_loop == uv_default_loop() && rt->external_event_loop_active) return; 324 + if (fetch_loop && fetch_loop == uv_default_loop() && (rt->flags & ANT_RUNTIME_EXT_EVENT_LOOP)) return; 325 325 if (fetch_loop && uv_loop_alive(fetch_loop)) { 326 326 uv_run(fetch_loop, UV_RUN_ONCE); 327 327 if (pending_requests && utarray_len(pending_requests) > 0) usleep(1000);
+2 -2
src/modules/fs.c
··· 312 312 313 313 static void ensure_fs_loop(void) { 314 314 if (!fs_loop) { 315 - if (rt->external_event_loop_active) { 315 + if (rt->flags & ANT_RUNTIME_EXT_EVENT_LOOP) { 316 316 fs_loop = uv_default_loop(); 317 317 } else { 318 318 fs_loop = malloc(sizeof(uv_loop_t)); ··· 1151 1151 } 1152 1152 1153 1153 void fs_poll_events(void) { 1154 - if (fs_loop && fs_loop == uv_default_loop() && rt->external_event_loop_active) return; 1154 + if (fs_loop && fs_loop == uv_default_loop() && (rt->flags & ANT_RUNTIME_EXT_EVENT_LOOP)) return; 1155 1155 if (fs_loop && uv_loop_alive(fs_loop)) { 1156 1156 uv_run(fs_loop, UV_RUN_ONCE); 1157 1157 if (pending_requests && utarray_len(pending_requests) > 0) usleep(1000);
+1 -1
src/modules/server.c
··· 979 979 uv_timer_init(g_loop, &g_js_timer); 980 980 981 981 g_js_timer.data = js; 982 - rt->external_event_loop_active = 1; 982 + rt->flags |= ANT_RUNTIME_EXT_EVENT_LOOP; 983 983 984 984 while (uv_loop_alive(g_loop)) { 985 985 if (has_pending_timers()) {
+1 -2
src/runtime.c
··· 9 9 struct ant_runtime *ant_runtime_init(struct js *js, int argc, char **argv) { 10 10 runtime.js = js; 11 11 runtime.ant_obj = js_mkobj(js); 12 - runtime.crypto_initialized = 0; 13 - runtime.external_event_loop_active = 0; 12 + runtime.flags = 0; 14 13 15 14 runtime.argc = argc; 16 15 runtime.argv = argv;