extend task system with thread count, so usage code can easily create per-thread state; pass thread idx into task entry points

This commit is contained in:
Ryan Fleury
2024-03-01 11:08:00 -08:00
parent 7eca2a35cd
commit 2fc0b4eac2
5 changed files with 94 additions and 117 deletions
+10 -1
View File
@@ -49,6 +49,15 @@ ts_init(void)
}
}
////////////////////////////////
//~ rjf: Top-Level Accessors
internal U64
ts_thread_count(void)
{
return ts_shared->task_threads_count;
}
////////////////////////////////
//~ rjf: High-Level Task Kickoff / Joining
@@ -190,7 +199,7 @@ ts_task_thread__entry_point(void *p)
}
//- rjf: run task
void *task_result = task_function(task_arena, task_params);
void *task_result = task_function(task_arena, thread_idx, task_params);
//- rjf: store into artifact
U64 artifact_num = task_ticket.u64[0];