mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
update threading API
This commit is contained in:
+6
-3
@@ -132,7 +132,10 @@ lnk_config_from_argcv(Arena *arena, int argc, char **argv)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
String8List raw_cmd_line = os_string_list_from_argcv(arena, argc, argv);
|
||||
String8List raw_cmd_line = {0};
|
||||
for EachIndex(i, argc) {
|
||||
str8_list_push(arena, &raw_cmd_line, str8_cstring(argv[i]));
|
||||
}
|
||||
|
||||
// remove exe name first argument
|
||||
str8_list_pop_front(&raw_cmd_line);
|
||||
@@ -4995,7 +4998,7 @@ lnk_run(TP_Context *tp, TP_Arena *arena, LNK_Config *config)
|
||||
image_write_ctx->path = config->image_name;
|
||||
image_write_ctx->temp_path = config->temp_image_name;
|
||||
image_write_ctx->data = image_ctx.image_data;
|
||||
OS_Handle image_write_thread = os_thread_launch(lnk_write_thread, image_write_ctx, 0);
|
||||
Thread image_write_thread = thread_launch(lnk_write_thread, image_write_ctx);
|
||||
|
||||
//
|
||||
// RAD Map
|
||||
@@ -5098,7 +5101,7 @@ lnk_run(TP_Context *tp, TP_Arena *arena, LNK_Config *config)
|
||||
}
|
||||
|
||||
// wait for the thread to finish writing image to disk
|
||||
os_thread_join(image_write_thread, -1);
|
||||
thread_join(image_write_thread, -1);
|
||||
|
||||
//
|
||||
// Timers
|
||||
|
||||
@@ -99,7 +99,7 @@ tp_alloc(Arena *arena, U32 worker_count, U32 max_worker_count, String8 name)
|
||||
// launch worker threads
|
||||
for (U64 i = 1; i < worker_count; i += 1) {
|
||||
TP_Worker *worker = &pool->worker_arr[i];
|
||||
worker->handle = os_thread_launch(worker_entry, worker, 0);
|
||||
worker->handle = thread_launch(worker_entry, worker);
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
@@ -114,20 +114,20 @@ 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) {
|
||||
os_semaphore_drop(pool->exec_semaphore);
|
||||
semaphore_drop(pool->exec_semaphore);
|
||||
}
|
||||
}
|
||||
for (U64 i = 0; i < pool->worker_count; ++i) {
|
||||
os_semaphore_drop(pool->task_semaphore);
|
||||
semaphore_drop(pool->task_semaphore);
|
||||
}
|
||||
for (U64 i = 1; i < pool->worker_count; i += 1) {
|
||||
os_thread_detach(pool->worker_arr[i].handle);
|
||||
thread_detach(pool->worker_arr[i].handle);
|
||||
}
|
||||
if (is_shared) {
|
||||
os_semaphore_release(pool->exec_semaphore);
|
||||
semaphore_release(pool->exec_semaphore);
|
||||
}
|
||||
os_semaphore_release(pool->task_semaphore);
|
||||
os_semaphore_release(pool->main_semaphore);
|
||||
semaphore_release(pool->task_semaphore);
|
||||
semaphore_release(pool->main_semaphore);
|
||||
|
||||
MemoryZeroStruct(pool);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ typedef struct TP_Worker
|
||||
{
|
||||
U64 id;
|
||||
struct TP_Context *pool;
|
||||
OS_Handle handle;
|
||||
Thread handle;
|
||||
} TP_Worker;
|
||||
|
||||
typedef struct TP_Context
|
||||
|
||||
Reference in New Issue
Block a user