provide mechanism to not wait at top of async loop

This commit is contained in:
Ryan Fleury
2025-09-18 16:20:17 -07:00
parent 30ae9620f9
commit 8e2ceeee9e
2 changed files with 10 additions and 2 deletions
+9 -2
View File
@@ -6,7 +6,7 @@ global CondVar async_tick_start_cond_var = {0};
global CondVar async_tick_stop_cond_var = {0};
global Mutex async_tick_start_mutex = {0};
global Mutex async_tick_stop_mutex = {0};
global U64 async_wait_timeout = 0;
global B32 async_loop_again = 0;
global B32 global_async_exit = 0;
internal void
@@ -190,7 +190,14 @@ async_thread_entry_point(void *params)
ThreadNameF("async_thread_%I64u", lane_idx());
for(;!ins_atomic_u32_eval(&global_async_exit);)
{
MutexScope(async_tick_start_mutex) cond_var_wait(async_tick_start_cond_var, async_tick_start_mutex, os_now_microseconds()+100000);
if(!ins_atomic_u32_eval(&async_loop_again))
{
MutexScope(async_tick_start_mutex) cond_var_wait(async_tick_start_cond_var, async_tick_start_mutex, os_now_microseconds()+100000);
if(lane_idx() == 0)
{
async_loop_again = 0;
}
}
#if defined(CONTENT_H)
c_tick();
#endif
+1
View File
@@ -728,6 +728,7 @@ dasm_tick(void)
req_n->v.hash = hash;
req_n->v.params = params;
req_n->v.params.dbgi_key = di_key_copy(dasm_shared->req_arena, &req_n->v.params.dbgi_key);
ins_atomic_u32_eval_assign(&async_loop_again, 1);
}
di_scope_close(di_scope);