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
+7 -1
View File
@@ -34,7 +34,8 @@ struct TS_TicketList
////////////////////////////////
//~ rjf: Task Request Types
typedef void *TS_TaskFunctionType(Arena *arena, void *user_data);
#define TS_TASK_FUNCTION_DEF(name) void *name(Arena *arena, U64 thread_idx, void *p)
typedef TS_TASK_FUNCTION_DEF(TS_TaskFunctionType);
////////////////////////////////
//~ rjf: Task Artifact Cache Types
@@ -118,6 +119,11 @@ internal void ts_ticket_list_push(Arena *arena, TS_TicketList *list, TS_Ticket t
internal void ts_init(void);
////////////////////////////////
//~ rjf: Top-Level Accessors
internal U64 ts_thread_count(void);
////////////////////////////////
//~ rjf: High-Level Task Kickoff / Joining