From 03e31145eed1f730f573d2f001eccbbbc517483b Mon Sep 17 00:00:00 2001 From: KN Date: Wed, 14 Jan 2026 20:47:09 +0100 Subject: [PATCH 1/3] perf(kernel:process): use RCU for process iteration --- include/kernel/proc/process.h | 30 +++++++++------------ src/kernel/fs/procfs.c | 6 +++-- src/kernel/proc/process.c | 49 ++++++++++------------------------- 3 files changed, 29 insertions(+), 56 deletions(-) diff --git a/include/kernel/proc/process.h b/include/kernel/proc/process.h index 2916a8aec..d5ce30574 100644 --- a/include/kernel/proc/process.h +++ b/include/kernel/proc/process.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -94,8 +95,16 @@ typedef struct process char** argv; uint64_t argc; group_member_t group; + rcu_entry_t rcu; } process_t; +/** + * @brief Global list of all processes. + * + * @warning Should only be read while in a RCU read-side critical section. + */ +extern list_t _processes; + /** * @brief Allocates and initializes a new process. * @@ -183,30 +192,15 @@ void process_kill(process_t* process, const char* status); */ void process_remove(process_t* process); -/** - * @brief Gets the first process in the system for iteration. - * - * @return A reference to the first process, or `NULL` if there are no processes. - */ -process_t* process_iterate_begin(void); - -/** - * @brief Gets the next process in the system for iteration. - * - * @param prev The current process in the iteration, will be unreferenced. - * @return A reference to the next process, or `NULL` if there are no more processes. - */ -process_t* process_iterate_next(process_t* prev); - /** * @brief Macro to iterate over all processes. * - * @note If the loop is exited early the `process` variable must be unreferenced. + * @warning Must be used within a RCU read-side critical section. * * @param process Loop variable, a pointer to `process_t`. */ -#define PROCESS_FOR_EACH(process) \ - for ((process) = process_iterate_begin(); (process) != NULL; (process) = process_iterate_next(process)) +#define PROCESS_RCU_FOR_EACH(process) \ + LIST_FOR_EACH(process, &_processes, entry) /** * @brief Sets the command line arguments for a process. diff --git a/src/kernel/fs/procfs.c b/src/kernel/fs/procfs.c index 661e4e2ce..264ac7870 100644 --- a/src/kernel/fs/procfs.c +++ b/src/kernel/fs/procfs.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -1206,8 +1207,10 @@ static uint64_t procfs_iterate(dentry_t* dentry, dir_ctx_t* ctx) } } + RCU_READ_SCOPE(); + process_t* process; - PROCESS_FOR_EACH(process) + PROCESS_RCU_FOR_EACH(process) { if (ctx->index++ < ctx->pos) { @@ -1218,7 +1221,6 @@ static uint64_t procfs_iterate(dentry_t* dentry, dir_ctx_t* ctx) snprintf(name, sizeof(name), "%llu", process->id); if (!ctx->emit(ctx, name, ino_gen(dentry->inode->number, name), INODE_DIR)) { - UNREF(process); return 0; } } diff --git a/src/kernel/proc/process.c b/src/kernel/proc/process.c index 3ae1df06b..3bdd51b63 100644 --- a/src/kernel/proc/process.c +++ b/src/kernel/proc/process.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -40,8 +40,9 @@ static process_t* kernelProcess = NULL; static _Atomic(pid_t) newPid = ATOMIC_VAR_INIT(0); static map_t pidMap = MAP_CREATE(); -static list_t processes = LIST_CREATE(processes); -static rwlock_t processesLock = RWLOCK_CREATE(); + +list_t _processes = LIST_CREATE(_processes); +static lock_t processesLock = LOCK_CREATE(); static void process_free(process_t* process) { @@ -75,7 +76,8 @@ static void process_free(process_t* process) wait_queue_deinit(&process->suspendQueue); futex_ctx_deinit(&process->futexCtx); env_deinit(&process->env); - free(process); + + rcu_call(&process->rcu, rcu_call_free, process); } process_t* process_new(priority_t priority, group_member_t* group, namespace_t* ns) @@ -132,24 +134,26 @@ process_t* process_new(priority_t priority, group_member_t* group, namespace_t* return NULL; } - RWLOCK_WRITE_SCOPE(&processesLock); + lock_acquire(&processesLock); map_key_t mapKey = map_key_uint64(process->id); if (map_insert(&pidMap, &mapKey, &process->mapEntry) == ERR) { + lock_release(&processesLock); process_free(process); return NULL; } LOG_DEBUG("created process pid=%d\n", process->id); - list_push_back(&processes, &process->entry); + list_push_back(&_processes, &process->entry); + lock_release(&processesLock); return REF(process); } process_t* process_get(pid_t id) { - RWLOCK_READ_SCOPE(&processesLock); + RCU_READ_SCOPE(); map_key_t mapKey = map_key_uint64(id); map_entry_t* entry = map_get(&pidMap, &mapKey); @@ -244,41 +248,14 @@ void process_kill(process_t* process, const char* status) void process_remove(process_t* process) { - rwlock_write_acquire(&processesLock); + lock_acquire(&processesLock); map_remove(&pidMap, &process->mapEntry); list_remove(&process->entry); - rwlock_write_release(&processesLock); + lock_release(&processesLock); UNREF(process); } -process_t* process_iterate_begin(void) -{ - RWLOCK_READ_SCOPE(&processesLock); - - if (list_is_empty(&processes)) - { - return NULL; - } - - return REF(CONTAINER_OF(list_first(&processes), process_t, entry)); -} - -process_t* process_iterate_next(process_t* prev) -{ - RWLOCK_READ_SCOPE(&processesLock); - - list_entry_t* nextEntry = list_next(&processes, &prev->entry); - UNREF(prev); - - if (nextEntry == NULL) - { - return NULL; - } - - return REF(CONTAINER_OF(nextEntry, process_t, entry)); -} - uint64_t process_set_cmdline(process_t* process, char** argv, uint64_t argc) { if (process == NULL) From b703fe9d9b75936834134363349f13e44279e3f2 Mon Sep 17 00:00:00 2001 From: KN Date: Wed, 14 Jan 2026 21:27:58 +0100 Subject: [PATCH 2/3] pref(kernel): optimize thread and process sync using RCU --- include/kernel/proc/process.h | 48 ++++++++++++++++++++++++++++++----- include/kernel/sched/thread.h | 16 +++++++----- src/kernel/fs/procfs.c | 11 ++++---- src/kernel/proc/group.c | 5 ++-- src/kernel/proc/process.c | 27 ++++++++++---------- src/kernel/proc/reaper.c | 7 +++-- src/kernel/sched/thread.c | 48 ++++++++++++++++++++--------------- 7 files changed, 105 insertions(+), 57 deletions(-) diff --git a/include/kernel/proc/process.h b/include/kernel/proc/process.h index d5ce30574..3c093d4d0 100644 --- a/include/kernel/proc/process.h +++ b/include/kernel/proc/process.h @@ -12,8 +12,8 @@ #include #include #include -#include #include +#include #include #include @@ -46,8 +46,9 @@ typedef enum */ typedef struct { - tid_t newTid; - list_t list; + _Atomic(tid_t) newTid; + list_t list; ///< Reads are RCU protected, writes require the lock. + uint64_t count; lock_t lock; } process_threads_t; @@ -100,7 +101,7 @@ typedef struct process /** * @brief Global list of all processes. - * + * * @warning Should only be read while in a RCU read-side critical section. */ extern list_t _processes; @@ -192,6 +193,42 @@ void process_kill(process_t* process, const char* status); */ void process_remove(process_t* process); +/** + * @brief Gets the first thread of a process. + * + * @warning Must be used within a RCU read-side critical section. + * + * @param process The process to get the first thread of. + * @return The first thread of the process, or `NULL` if the process has no threads. + */ +static inline thread_t* process_rcu_first_thread(process_t* process) +{ + return CONTAINER_OF_SAFE(list_first(&process->threads.list), thread_t, processEntry); +} + +/** + * @brief Gets the amount of threads in a process. + * + * @warning Must be used within a RCU read-side critical section. + * + * @param process The process to get the thread amount of. + * @return The amount of threads in the process. + */ +static inline uint64_t process_rcu_thread_count(process_t* process) +{ + return process->threads.count; +} + +/** + * @brief Macro to iterate over all threads in a process. + * + * @warning Must be used within a RCU read-side critical section. + * + * @param thread Loop variable, a pointer to `thread_t`. + * @param process The process to iterate the threads of. + */ +#define PROCESS_RCU_THREAD_FOR_EACH(thread, process) LIST_FOR_EACH(thread, &(process)->threads.list, processEntry) + /** * @brief Macro to iterate over all processes. * @@ -199,8 +236,7 @@ void process_remove(process_t* process); * * @param process Loop variable, a pointer to `process_t`. */ -#define PROCESS_RCU_FOR_EACH(process) \ - LIST_FOR_EACH(process, &_processes, entry) +#define PROCESS_RCU_FOR_EACH(process) LIST_FOR_EACH(process, &_processes, entry) /** * @brief Sets the command line arguments for a process. diff --git a/include/kernel/sched/thread.h b/include/kernel/sched/thread.h index be843b2cb..e0317f558 100644 --- a/include/kernel/sched/thread.h +++ b/include/kernel/sched/thread.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -77,6 +78,7 @@ typedef struct thread note_queue_t notes; syscall_ctx_t syscall; perf_thread_ctx_t perf; + rcu_entry_t rcu; /** * The threads interrupt frame is used to save the values in the CPU registers such that the scheduler can continue * executing the thread later on. @@ -94,6 +96,13 @@ typedef struct thread */ thread_t* thread_new(process_t* process); +/** + * @brief Frees a thread structure. + * + * @param thread The thread to be freed. + */ +void thread_free(thread_t* thread); + /** * @brief Kernel thread entry point function type. */ @@ -108,13 +117,6 @@ typedef void (*thread_kernel_entry_t)(void* arg); */ tid_t thread_kernel_create(thread_kernel_entry_t entry, void* arg); -/** - * @brief Frees a thread structure. - * - * @param thread The thread to be freed. - */ -void thread_free(thread_t* thread); - /** * @brief Retrieves the currently running thread. * diff --git a/src/kernel/fs/procfs.c b/src/kernel/fs/procfs.c index 264ac7870..93df16f42 100644 --- a/src/kernel/fs/procfs.c +++ b/src/kernel/fs/procfs.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -251,9 +252,9 @@ static size_t procfs_note_write(file_t* file, const void* buffer, size_t count, process_t* process = file->inode->private; - LOCK_SCOPE(&process->threads.lock); + RCU_READ_SCOPE(); - thread_t* thread = CONTAINER_OF_SAFE(list_first(&process->threads.list), thread_t, processEntry); + thread_t* thread = process_rcu_first_thread(process); if (thread == NULL) { errno = EINVAL; @@ -385,9 +386,9 @@ static size_t procfs_perf_read(file_t* file, void* buffer, size_t count, size_t* process_t* process = file->inode->private; size_t userPages = space_user_page_count(&process->space); - lock_acquire(&process->threads.lock); - size_t threadCount = list_size(&process->threads.list); - lock_release(&process->threads.lock); + RCU_READ_SCOPE(); + + size_t threadCount = process_rcu_thread_count(process); clock_t userClocks = atomic_load(&process->perf.userClocks); clock_t kernelClocks = atomic_load(&process->perf.kernelClocks); diff --git a/src/kernel/proc/group.c b/src/kernel/proc/group.c index c5e5ef599..d9e791640 100644 --- a/src/kernel/proc/group.c +++ b/src/kernel/proc/group.c @@ -9,6 +9,7 @@ #include #include +#include #include static void group_free(group_t* group) @@ -158,9 +159,9 @@ uint64_t group_send_note(group_member_t* member, const char* note) process_t* process; LIST_FOR_EACH(process, &group->processes, group.entry) { - LOCK_SCOPE(&process->threads.lock); + RCU_READ_SCOPE(); - thread_t* thread = CONTAINER_OF_SAFE(list_first(&process->threads.list), thread_t, processEntry); + thread_t* thread = process_rcu_first_thread(process); if (thread == NULL) { continue; diff --git a/src/kernel/proc/process.c b/src/kernel/proc/process.c index 3bdd51b63..323256df0 100644 --- a/src/kernel/proc/process.c +++ b/src/kernel/proc/process.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,8 @@ static map_t pidMap = MAP_CREATE(); list_t _processes = LIST_CREATE(_processes); static lock_t processesLock = LOCK_CREATE(); +static cache_t cache = CACHE_CREATE(cache, "process", sizeof(process_t), CACHE_LINE, NULL, NULL); + static void process_free(process_t* process) { LOG_DEBUG("freeing process pid=%d\n", process->id); @@ -76,8 +79,8 @@ static void process_free(process_t* process) wait_queue_deinit(&process->suspendQueue); futex_ctx_deinit(&process->futexCtx); env_deinit(&process->env); - - rcu_call(&process->rcu, rcu_call_free, process); + + rcu_call(&process->rcu, rcu_call_cache_free, process); } process_t* process_new(priority_t priority, group_member_t* group, namespace_t* ns) @@ -88,7 +91,7 @@ process_t* process_new(priority_t priority, group_member_t* group, namespace_t* return NULL; } - process_t* process = malloc(sizeof(process_t)); + process_t* process = cache_alloc(&cache); if (process == NULL) { errno = ENOMEM; @@ -107,7 +110,7 @@ process_t* process_new(priority_t priority, group_member_t* group, namespace_t* if (space_init(&process->space, VMM_USER_SPACE_MIN, VMM_USER_SPACE_MAX, SPACE_MAP_KERNEL_BINARY | SPACE_MAP_KERNEL_HEAP | SPACE_MAP_IDENTITY) == ERR) { - free(process); + cache_free(process); return NULL; } @@ -121,8 +124,9 @@ process_t* process_new(priority_t priority, group_member_t* group, namespace_t* wait_queue_init(&process->suspendQueue); wait_queue_init(&process->dyingQueue); atomic_init(&process->flags, PROCESS_NONE); - process->threads.newTid = 0; + atomic_init(&process->threads.newTid, 0); list_init(&process->threads.list); + process->threads.count = 0; lock_init(&process->threads.lock); env_init(&process->env); process->argv = NULL; @@ -201,11 +205,8 @@ void process_set_ns(process_t* process, namespace_t* ns) void process_kill(process_t* process, const char* status) { - lock_acquire(&process->threads.lock); - if (atomic_fetch_or(&process->flags, PROCESS_DYING) & PROCESS_DYING) { - lock_release(&process->threads.lock); return; } @@ -214,9 +215,11 @@ void process_kill(process_t* process, const char* status) process->status.buffer[PROCESS_STATUS_MAX - 1] = '\0'; lock_release(&process->status.lock); + RCU_READ_SCOPE(); + uint64_t killCount = 0; thread_t* thread; - LIST_FOR_EACH(thread, &process->threads.list, processEntry) + PROCESS_RCU_THREAD_FOR_EACH(thread, process) { thread_send_note(thread, "kill"); killCount++; @@ -227,8 +230,6 @@ void process_kill(process_t* process, const char* status) LOG_DEBUG("sent kill note to %llu threads in process pid=%d\n", killCount, process->id); } - lock_release(&process->threads.lock); - // Anything that another process could be waiting on must be cleaned up here. cwd_clear(&process->cwd); @@ -322,10 +323,10 @@ uint64_t process_set_cmdline(process_t* process, char** argv, uint64_t argc) bool process_has_thread(process_t* process, tid_t tid) { - LOCK_SCOPE(&process->threads.lock); + RCU_READ_SCOPE(); thread_t* thread; - LIST_FOR_EACH(thread, &process->threads.list, processEntry) + PROCESS_RCU_THREAD_FOR_EACH(thread, process) { if (thread->id == tid) { diff --git a/src/kernel/proc/reaper.c b/src/kernel/proc/reaper.c index 4a6cb8ebf..a04bcf590 100644 --- a/src/kernel/proc/reaper.c +++ b/src/kernel/proc/reaper.c @@ -6,6 +6,7 @@ #include #include #include +#include static list_t zombies = LIST_CREATE(zombies); static clock_t nextReaperTime = CLOCKS_NEVER; @@ -34,14 +35,12 @@ static void reaper_thread(void* arg) { process_t* process = CONTAINER_OF(list_pop_front(&zombies), process_t, zombieEntry); - lock_acquire(&process->threads.lock); - if (!list_is_empty(&process->threads.list)) + RCU_READ_SCOPE(); + if (process_rcu_thread_count(process) > 0) { - lock_release(&process->threads.lock); list_push_back(&zombies, &process->zombieEntry); continue; } - lock_release(&process->threads.lock); list_push_back(&localZombies, &process->zombieEntry); } diff --git a/src/kernel/sched/thread.c b/src/kernel/sched/thread.c index 8543d8105..4fbcccfa1 100644 --- a/src/kernel/sched/thread.c +++ b/src/kernel/sched/thread.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +18,8 @@ #include #include +static cache_t cache = CACHE_CREATE(cache, "thread", sizeof(thread_t), CACHE_LINE, NULL, NULL); + static uintptr_t thread_id_to_offset(tid_t tid, uint64_t maxPages) { return tid * ((maxPages + STACK_POINTER_GUARD_PAGES) * PAGE_SIZE); @@ -30,24 +33,23 @@ thread_t* thread_new(process_t* process) return NULL; } - thread_t* thread = malloc(sizeof(thread_t)); + thread_t* thread = cache_alloc(&cache); if (thread == NULL) { errno = ENOMEM; return NULL; } - LOCK_SCOPE(&process->threads.lock); - if (atomic_load(&process->flags) & PROCESS_DYING) { + cache_free(thread); errno = EINVAL; return NULL; } thread->process = process; + thread->id = atomic_fetch_add_explicit(&process->threads.newTid, 1, memory_order_relaxed); list_entry_init(&thread->processEntry); - thread->id = thread->process->threads.newTid++; sched_client_init(&thread->sched); atomic_init(&thread->state, THREAD_PARKED); thread->error = 0; @@ -55,20 +57,20 @@ thread_t* thread_new(process_t* process) VMM_KERNEL_STACKS_MAX - thread_id_to_offset(thread->id, CONFIG_MAX_KERNEL_STACK_PAGES), CONFIG_MAX_KERNEL_STACK_PAGES) == ERR) { - free(thread); + cache_free(thread); return NULL; } if (stack_pointer_init(&thread->userStack, VMM_USER_SPACE_MAX - thread_id_to_offset(thread->id, CONFIG_MAX_USER_STACK_PAGES), CONFIG_MAX_USER_STACK_PAGES) == ERR) { - free(thread); + cache_free(thread); return NULL; } wait_client_init(&thread->wait); if (simd_ctx_init(&thread->simd) == ERR) { - free(thread); + cache_free(thread); return NULL; } note_queue_init(&thread->notes); @@ -78,10 +80,29 @@ thread_t* thread_new(process_t* process) memset(&thread->frame, 0, sizeof(interrupt_frame_t)); REF(process); + + lock_acquire(&process->threads.lock); + process->threads.count++; list_push_back(&process->threads.list, &thread->processEntry); + lock_release(&process->threads.lock); return thread; } +void thread_free(thread_t* thread) +{ + lock_acquire(&thread->process->threads.lock); + thread->process->threads.count--; + list_remove(&thread->processEntry); + lock_release(&thread->process->threads.lock); + + UNREF(thread->process); + thread->process = NULL; + + simd_ctx_deinit(&thread->simd); + + rcu_call(&thread->rcu, rcu_call_cache_free, thread); +} + tid_t thread_kernel_create(thread_kernel_entry_t entry, void* arg) { if (entry == NULL) @@ -109,19 +130,6 @@ tid_t thread_kernel_create(thread_kernel_entry_t entry, void* arg) return tid; } -void thread_free(thread_t* thread) -{ - lock_acquire(&thread->process->threads.lock); - list_remove(&thread->processEntry); - lock_release(&thread->process->threads.lock); - - UNREF(thread->process); - thread->process = NULL; - - simd_ctx_deinit(&thread->simd); - free(thread); -} - void thread_save(thread_t* thread, const interrupt_frame_t* frame) { simd_ctx_save(&thread->simd); From 8bd369333d8bc53741e15ceceb62d4ab3071e523 Mon Sep 17 00:00:00 2001 From: KN Date: Wed, 14 Jan 2026 21:44:21 +0100 Subject: [PATCH 3/3] refactor(libstd:threading): rename thread.h to threading.h --- src/libstd/functions/errno/errno.c | 2 +- src/libstd/user/common/{thread.c => threading.c} | 6 +----- src/libstd/user/common/{thread.h => threading.h} | 0 src/libstd/user/functions/thread/mtx_destroy.c | 2 +- src/libstd/user/functions/thread/mtx_init.c | 2 +- src/libstd/user/functions/thread/mtx_lock.c | 2 +- src/libstd/user/functions/thread/mtx_unlock.c | 2 +- src/libstd/user/functions/thread/thrd_create.c | 2 +- src/libstd/user/functions/thread/thrd_current.c | 2 +- src/libstd/user/functions/thread/thrd_detach.c | 2 +- src/libstd/user/functions/thread/thrd_equal.c | 2 +- src/libstd/user/functions/thread/thrd_exit.c | 2 +- src/libstd/user/functions/thread/thrd_join.c | 2 +- src/libstd/user/functions/thread/thrd_sleep.c | 2 +- src/libstd/user/functions/thread/thrd_yield.c | 2 +- src/libstd/user/user.c | 2 +- 16 files changed, 15 insertions(+), 19 deletions(-) rename src/libstd/user/common/{thread.c => threading.c} (96%) rename src/libstd/user/common/{thread.h => threading.h} (100%) diff --git a/src/libstd/functions/errno/errno.c b/src/libstd/functions/errno/errno.c index 9904f62c6..99b3e98f4 100644 --- a/src/libstd/functions/errno/errno.c +++ b/src/libstd/functions/errno/errno.c @@ -4,7 +4,7 @@ #include #include #else -#include "user/common/thread.h" +#include "user/common/threading.h" #include #endif diff --git a/src/libstd/user/common/thread.c b/src/libstd/user/common/threading.c similarity index 96% rename from src/libstd/user/common/thread.c rename to src/libstd/user/common/threading.c index bd419a494..efc6fed3d 100644 --- a/src/libstd/user/common/thread.c +++ b/src/libstd/user/common/threading.c @@ -1,4 +1,4 @@ -#include "thread.h" +#include "threading.h" #include "syscalls.h" #include @@ -75,10 +75,6 @@ void _threading_init(void) _NORETURN static void _thread_entry(_thread_t* thread) { - // Synchronize with creator - mtx_lock(&entryMutex); - mtx_unlock(&entryMutex); - thrd_exit(thread->func(thread->arg)); } diff --git a/src/libstd/user/common/thread.h b/src/libstd/user/common/threading.h similarity index 100% rename from src/libstd/user/common/thread.h rename to src/libstd/user/common/threading.h diff --git a/src/libstd/user/functions/thread/mtx_destroy.c b/src/libstd/user/functions/thread/mtx_destroy.c index 65d33ea52..d46c60084 100644 --- a/src/libstd/user/functions/thread/mtx_destroy.c +++ b/src/libstd/user/functions/thread/mtx_destroy.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" void mtx_destroy(mtx_t* mutex) { diff --git a/src/libstd/user/functions/thread/mtx_init.c b/src/libstd/user/functions/thread/mtx_init.c index c691a6227..c33efb157 100644 --- a/src/libstd/user/functions/thread/mtx_init.c +++ b/src/libstd/user/functions/thread/mtx_init.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int mtx_init(mtx_t* mutex, int type) { diff --git a/src/libstd/user/functions/thread/mtx_lock.c b/src/libstd/user/functions/thread/mtx_lock.c index 9059ec3a4..de3e61508 100644 --- a/src/libstd/user/functions/thread/mtx_lock.c +++ b/src/libstd/user/functions/thread/mtx_lock.c @@ -6,7 +6,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int mtx_lock(mtx_t* mutex) { diff --git a/src/libstd/user/functions/thread/mtx_unlock.c b/src/libstd/user/functions/thread/mtx_unlock.c index 06befe539..6d9359837 100644 --- a/src/libstd/user/functions/thread/mtx_unlock.c +++ b/src/libstd/user/functions/thread/mtx_unlock.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int mtx_unlock(mtx_t* mutex) { diff --git a/src/libstd/user/functions/thread/thrd_create.c b/src/libstd/user/functions/thread/thrd_create.c index 7a3825b8b..3947490c5 100644 --- a/src/libstd/user/functions/thread/thrd_create.c +++ b/src/libstd/user/functions/thread/thrd_create.c @@ -6,7 +6,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int thrd_create(thrd_t* thr, thrd_start_t func, void* arg) { diff --git a/src/libstd/user/functions/thread/thrd_current.c b/src/libstd/user/functions/thread/thrd_current.c index afa0a3cfb..a499e1b1c 100644 --- a/src/libstd/user/functions/thread/thrd_current.c +++ b/src/libstd/user/functions/thread/thrd_current.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" thrd_t thrd_current(void) { diff --git a/src/libstd/user/functions/thread/thrd_detach.c b/src/libstd/user/functions/thread/thrd_detach.c index fbabbe6eb..86b189806 100644 --- a/src/libstd/user/functions/thread/thrd_detach.c +++ b/src/libstd/user/functions/thread/thrd_detach.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int thrd_detach(thrd_t thr) { diff --git a/src/libstd/user/functions/thread/thrd_equal.c b/src/libstd/user/functions/thread/thrd_equal.c index ab5fc0fba..fb71c45bb 100644 --- a/src/libstd/user/functions/thread/thrd_equal.c +++ b/src/libstd/user/functions/thread/thrd_equal.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int thrd_equal(thrd_t lhs, thrd_t rhs) { diff --git a/src/libstd/user/functions/thread/thrd_exit.c b/src/libstd/user/functions/thread/thrd_exit.c index ab86f4899..4dd20bd0d 100644 --- a/src/libstd/user/functions/thread/thrd_exit.c +++ b/src/libstd/user/functions/thread/thrd_exit.c @@ -6,7 +6,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" void thrd_exit(int res) { diff --git a/src/libstd/user/functions/thread/thrd_join.c b/src/libstd/user/functions/thread/thrd_join.c index cd494e8ef..7e20f400a 100644 --- a/src/libstd/user/functions/thread/thrd_join.c +++ b/src/libstd/user/functions/thread/thrd_join.c @@ -6,7 +6,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int thrd_join(thrd_t thr, int* res) { diff --git a/src/libstd/user/functions/thread/thrd_sleep.c b/src/libstd/user/functions/thread/thrd_sleep.c index 7a3edbef3..a5ed844c1 100644 --- a/src/libstd/user/functions/thread/thrd_sleep.c +++ b/src/libstd/user/functions/thread/thrd_sleep.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" int thrd_sleep(const struct timespec* duration, struct timespec* remaining) { diff --git a/src/libstd/user/functions/thread/thrd_yield.c b/src/libstd/user/functions/thread/thrd_yield.c index a8e6fcecf..07ca49e49 100644 --- a/src/libstd/user/functions/thread/thrd_yield.c +++ b/src/libstd/user/functions/thread/thrd_yield.c @@ -5,7 +5,7 @@ #include #include "user/common/syscalls.h" -#include "user/common/thread.h" +#include "user/common/threading.h" void thrd_yield(void) { diff --git a/src/libstd/user/user.c b/src/libstd/user/user.c index 29176fa12..41739f1a2 100644 --- a/src/libstd/user/user.c +++ b/src/libstd/user/user.c @@ -3,7 +3,7 @@ #include "common/clock.h" #include "common/exit_stack.h" #include "common/std_streams.h" -#include "common/thread.h" +#include "common/threading.h" #include "user/common/file.h" #include "user/common/note.h"