do not unnecessarily block on parses when closing modules

This commit is contained in:
Ryan Fleury
2025-06-25 09:41:48 -07:00
parent 10a49ca331
commit e2eb1cd6d6
2 changed files with 12 additions and 2 deletions
+1
View File
@@ -4681,6 +4681,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
out_evt->entity_id = event->code;
}break;
case DMN_EventKind_UnloadModule:
ProfScope("unload module %.*s", str8_varg(event->string))
{
CTRL_Event *out_evt = ctrl_event_list_push(scratch.arena, &evts);
CTRL_Handle module_handle = ctrl_handle_make(CTRL_MachineID_Local, event->module);
+11 -2
View File
@@ -543,8 +543,7 @@ di_close(DI_Key *key)
if(node->ref_count == 0) for(;;)
{
//- rjf: release
if(ins_atomic_u64_eval(&node->touch_count) == 0 &&
ins_atomic_u64_eval(&node->is_working) == 0)
if(ins_atomic_u64_eval(&node->touch_count) == 0)
{
di_string_release__stripe_mutex_w_guarded(stripe, node->key.path);
if(node->file_base != 0)
@@ -1129,6 +1128,16 @@ ASYNC_WORK_DEF(di_parse_work)
node->rdi = rdi_parsed;
node->parse_done = 1;
}
else
{
if(rdi_parsed_arena != 0)
{
arena_release(rdi_parsed_arena);
}
os_file_map_view_close(file_map, file_base, r1u64(0, file_props.size));
os_file_map_close(file_map);
os_file_close(file);
}
}
os_condition_variable_broadcast(stripe->cv);