mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-17 19:50:12 -08:00
fix clang /O2
This commit is contained in:
1 parent
f72d127aaa
commit
77ece3193e
4 files changed
+60
-33
No files matched your search
@@ -259,3 +259,20 @@ tp_broadcast_(TP_Context *tp, U64 task_id, void *ptr)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
tp_sum_u64(TP_Context *tp, U64 task_id, U64 v)
|
||||
{
|
||||
if (task_id == 0) {
|
||||
tp->sum = 0;
|
||||
}
|
||||
barrier_wait(tp->barrier);
|
||||
|
||||
ins_atomic_u64_add_eval(&tp->sum, v);
|
||||
barrier_wait(tp->barrier);
|
||||
|
||||
U64 result = tp->sum;
|
||||
barrier_wait(tp->barrier);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
struct TP_Context;
|
||||
#define THREAD_POOL_TASK_FUNC(name) void name(Arena *arena, U64 worker_id, U64 task_id, void *raw_task, struct TP_Context *tp)
|
||||
#define THREAD_POOL_TASK_FUNC(name) void name(Arena *arena, volatile U64 worker_id, volatile U64 task_id, void *raw_task, struct TP_Context *tp)
|
||||
typedef THREAD_POOL_TASK_FUNC(TP_TaskFunc);
|
||||
|
||||
typedef struct TP_Arena
|
||||
@@ -34,6 +34,7 @@ typedef struct TP_Context
|
||||
Semaphore main_semaphore;
|
||||
Barrier barrier;
|
||||
void *broadcast;
|
||||
U64 sum;
|
||||
|
||||
U32 worker_count;
|
||||
TP_Worker *worker_arr;
|
||||
|
||||
Reference in new issue
Block a user