Skip to content

Commit

Permalink
Debug compile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Novum committed Apr 10, 2023
1 parent 8315b06 commit cf03023
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Quake/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ TASKS_TEST_ASSERT
LotsOfTasks
=================
*/
static void LotsOfTasksTestTask (void **counters_ptr)
static void LotsOfTasksTestTask (void *counters_ptr)
{
uint32_t *counters = (uint32_t *)(*counters_ptr);
uint32_t *counters = *((uint32_t **)counters_ptr);
++counters[Tasks_GetWorkerIndex ()];
}
static void LotsOfTasks (void)
Expand All @@ -578,31 +578,32 @@ static void LotsOfTasks (void)
TEMP_ALLOC_ZEROED (uint32_t, counters, TASKS_MAX_WORKERS);
TEMP_ALLOC (task_handle_t, handles, NUM_TASKS);
for (int i = 0; i < NUM_TASKS; ++i)
handles[i] = Task_AllocateAssignFuncAndSubmit (LotsOfTasksTestTask, &counters, sizeof (uint32_t *));
handles[i] = Task_AllocateAssignFuncAndSubmit (LotsOfTasksTestTask, (void *)&counters, sizeof (uint32_t *));
for (int i = 0; i < NUM_TASKS; ++i)
Task_Join (handles[i], SDL_MUTEX_MAXWAIT);
uint32_t counters_sum = 0;
for (int i = 0; i < TASKS_MAX_WORKERS; ++i)
counters_sum += counters[i];
TASKS_TEST_ASSERT (counters_sum == NUM_TASKS, "Wrong counters_sum");
TEMP_FREE (handles);
TEMP_FREE (counters);
}

/*
=================
IndexedTasks
=================
*/
static void IndexedTestTask (int index, void **counters_ptr)
static void IndexedTestTask (int index, void *counters_ptr)
{
uint32_t *counters = (uint32_t *)(*counters_ptr);
uint32_t *counters = *((uint32_t **)counters_ptr);
++counters[Tasks_GetWorkerIndex ()];
}
static void IndexedTasks ()
{
static const int LIMIT = 100000;
TEMP_ALLOC_ZEROED (uint32_t, counters, TASKS_MAX_WORKERS);
task_handle_t task = Task_AllocateAssignIndexedFuncAndSubmit (IndexedTestTask, LIMIT, &counters, sizeof (uint32_t *));
task_handle_t task = Task_AllocateAssignIndexedFuncAndSubmit (IndexedTestTask, LIMIT, (void *)&counters, sizeof (uint32_t *));
Task_Join (task, SDL_MUTEX_MAXWAIT);
uint32_t counters_sum = 0;
for (int i = 0; i < TASKS_MAX_WORKERS; ++i)
Expand Down

0 comments on commit cf03023

Please sign in to comment.