fix call stack flickering; do not timeout early if we need to fall back to stale results after requesting new call stack compute

This commit is contained in:
Ryan Fleury
2025-07-23 10:38:59 -07:00
parent 64a0682611
commit 6026ac16d4
+7 -7
View File
@@ -3426,7 +3426,7 @@ ctrl_call_stack_from_thread(CTRL_Scope *scope, CTRL_EntityCtx *entity_ctx, CTRL_
//- rjf: loop: try to grab cached call stack; request; wait
//
B32 can_request = !ins_atomic_u64_eval(&ctrl_state->ctrl_thread_run_state);
for(;;)
for(U64 retry_idx = 0;; retry_idx += 1)
{
//- rjf: [read-only] try to look for current call stack; wait if working
B32 node_exists = 0;
@@ -3462,6 +3462,12 @@ ctrl_call_stack_from_thread(CTRL_Scope *scope, CTRL_EntityCtx *entity_ctx, CTRL_
}
}
//- rjf: out of time => exit
if(retry_idx > 0 && os_now_microseconds() >= endt_us)
{
break;
}
//- rjf: [write] node does not exist => create; request if new or stale
B32 need_request = (!node_exists || node_stale);
CTRL_CallStackCacheNode *node_to_request = 0;
@@ -3501,12 +3507,6 @@ ctrl_call_stack_from_thread(CTRL_Scope *scope, CTRL_EntityCtx *entity_ctx, CTRL_
node_to_request->working_count -= 1;
}
}
//- rjf: out of time => exit
if(os_now_microseconds() >= endt_us)
{
break;
}
}
return call_stack;