mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-15 16:42:23 -07:00
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:
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user