first pass at setting up base layer async thread path

This commit is contained in:
Ryan Fleury
2025-09-17 10:06:21 -07:00
parent 443646b356
commit 99c989a3c3
5 changed files with 162 additions and 2 deletions
+18
View File
@@ -2,6 +2,8 @@
// Licensed under the MIT license (https://opensource.org/license/mit/)
global U64 global_update_tick_idx = 0;
global CondVar async_tick_cond_var = {0};
global Mutex async_tick_mutex = {0};
internal void
main_thread_base_entry_point(int arguments_count, char **arguments)
@@ -9,6 +11,10 @@ main_thread_base_entry_point(int arguments_count, char **arguments)
Temp scratch = scratch_begin(0, 0);
ThreadNameF("[main thread]");
//- rjf: set up async thread group info
async_tick_cond_var = cond_var_alloc();
async_tick_mutex = mutex_alloc();
//- rjf: set up telemetry
#if PROFILE_TELEMETRY
local_persist char tm_data[MB(64)];
@@ -133,3 +139,15 @@ update(void)
#endif
return result;
}
internal void
async_thread_entry_point(void *params)
{
MutexScope(async_tick_mutex) for(;;)
{
cond_var_wait(async_tick_cond_var, async_tick_mutex, max_U64);
#if defined(FILE_STREAM_H)
fs_async_tick();
#endif
}
}