report user errors from ctrl thread more vigorously

This commit is contained in:
Ryan Fleury
2025-07-23 14:06:17 -07:00
parent a85284793b
commit 8d1de1b24c
2 changed files with 13 additions and 21 deletions
+11 -18
View File
@@ -3868,16 +3868,7 @@ ctrl_thread__entry_point(void *p)
ins_atomic_u64_inc_eval(&ctrl_state->reg_gen);
//- rjf: gather & output logs
LogScopeResult log = log_scope_end(scratch.arena);
ctrl_thread__flush_info_log(log.strings[LogMsgKind_Info]);
if(log.strings[LogMsgKind_UserError].size != 0)
{
CTRL_EventList evts = {0};
CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts);
evt->kind = CTRL_EventKind_Error;
evt->string = log.strings[LogMsgKind_UserError];
ctrl_c2u_push_events(&evts);
}
ctrl_thread__end_and_flush_log();
}
scratch_end(scratch);
@@ -5279,17 +5270,19 @@ ctrl_thread__eval_scope_end(CTRL_EvalScope *scope)
//- rjf: log flusher
internal void
ctrl_thread__flush_info_log(String8 string)
{
os_append_data_to_file_path(ctrl_state->ctrl_thread_log_path, string);
}
internal void
ctrl_thread__end_and_flush_info_log(void)
ctrl_thread__end_and_flush_log(void)
{
Temp scratch = scratch_begin(0, 0);
LogScopeResult log = log_scope_end(scratch.arena);
ctrl_thread__flush_info_log(log.strings[LogMsgKind_Info]);
os_append_data_to_file_path(ctrl_state->ctrl_thread_log_path, log.strings[LogMsgKind_Info]);
if(log.strings[LogMsgKind_UserError].size != 0)
{
CTRL_EventList evts = {0};
CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts);
evt->kind = CTRL_EventKind_Error;
evt->string = log.strings[LogMsgKind_UserError];
ctrl_c2u_push_events(&evts);
}
scratch_end(scratch);
}