use spinlocks and other fixes

This commit is contained in:
2025-06-07 17:09:03 -05:00
parent c02bd06ec0
commit d039e2cfe6
7 changed files with 183 additions and 108 deletions

View File

@@ -166,16 +166,9 @@ JSC_CCALL(actor_on_exception,
JSC_CCALL(actor_clock,
if (!JS_IsFunction(js, argv[0]))
return JS_ThrowReferenceError(js, "Argument must be a function.");
cell_rt *actor = JS_GetContextOpaque(js);
SDL_LockMutex(actor->msg_mutex);
letter l;
l.type = LETTER_CALLBACK;
l.callback = JS_DupValue(js, argv[0]);
arrput(actor->letters, l);
SDL_UnlockMutex(actor->msg_mutex);
printf("actor %s clocked\n", actor->id);
set_actor_state(actor);
actor_clock(actor, argv[0]);
)
static const JSCFunctionListEntry js_actor_funcs[] = {