mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-17 19:50:12 -08:00
WIP change symbol extraction approach
This commit is contained in:
1 parent
f57b149939
commit
e0c6df710f
12 files changed
+921
-994
No files matched your search
@@ -15,7 +15,7 @@ tp_run_tasks(TP_Context *pool, TP_Worker *worker)
|
||||
// run task
|
||||
Arena *arena = pool->task_arena ? pool->task_arena->v[worker->id] : 0;
|
||||
U64 task_id = pool->task_count - (task_left+1);
|
||||
pool->task_func(arena, worker->id, task_id, pool->task_data);
|
||||
pool->task_func(arena, worker->id, task_id, pool->task_data, pool);
|
||||
|
||||
// cache task count so we dont touch pool memory after atomic inc
|
||||
U64 task_count = pool->task_count;
|
||||
@@ -85,6 +85,7 @@ tp_alloc(Arena *arena, U32 worker_count, U32 max_worker_count, String8 name)
|
||||
pool->exec_semaphore = exec_semaphore;
|
||||
pool->task_semaphore = task_semaphore;
|
||||
pool->main_semaphore = main_semaphore;
|
||||
pool->barrier = barrier_alloc(worker_count);
|
||||
pool->is_live = 1;
|
||||
pool->worker_count = worker_count;
|
||||
pool->worker_arr = push_array(arena, TP_Worker, worker_count);
|
||||
@@ -113,11 +114,11 @@ tp_release(TP_Context *pool)
|
||||
|
||||
B32 is_shared = pool->exec_semaphore.u64[0] != 0;
|
||||
if (is_shared) {
|
||||
for (U64 i = 0; i < pool->worker_count; ++i) {
|
||||
for EachIndex(i, pool->worker_count) {
|
||||
semaphore_drop(pool->exec_semaphore);
|
||||
}
|
||||
}
|
||||
for (U64 i = 0; i < pool->worker_count; ++i) {
|
||||
for EachIndex(i, pool->worker_count) {
|
||||
semaphore_drop(pool->task_semaphore);
|
||||
}
|
||||
for (U64 i = 1; i < pool->worker_count; i += 1) {
|
||||
@@ -126,6 +127,7 @@ tp_release(TP_Context *pool)
|
||||
if (is_shared) {
|
||||
semaphore_release(pool->exec_semaphore);
|
||||
}
|
||||
barrier_release(pool->barrier);
|
||||
semaphore_release(pool->task_semaphore);
|
||||
semaphore_release(pool->main_semaphore);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define THREAD_POOL_TASK_FUNC(name) void name(Arena *arena, U64 worker_id, U64 task_id, void *raw_task)
|
||||
#define THREAD_POOL_TASK_FUNC(name) void name(Arena *arena, U64 worker_id, U64 task_id, void *raw_task, struct TP_Context *tp)
|
||||
typedef THREAD_POOL_TASK_FUNC(TP_TaskFunc);
|
||||
|
||||
typedef struct TP_Arena
|
||||
@@ -31,6 +31,7 @@ typedef struct TP_Context
|
||||
Semaphore exec_semaphore;
|
||||
Semaphore task_semaphore;
|
||||
Semaphore main_semaphore;
|
||||
Barrier barrier;
|
||||
|
||||
U32 worker_count;
|
||||
TP_Worker *worker_arr;
|
||||
|
||||
Reference in new issue
Block a user