From 83042cef13c807d62ba1ed8a4068a68f6acf0ab1 Mon Sep 17 00:00:00 2001 From: onelin Date: Fri, 31 Oct 2025 21:30:14 +0100 Subject: Remove unused threading snippet --- src/core/CMakeLists.txt | 1 - src/core/include/engine/core/thread.h | 19 ------------------ src/core/src/thread.c | 38 ----------------------------------- 3 files changed, 58 deletions(-) delete mode 100644 src/core/include/engine/core/thread.h delete mode 100644 src/core/src/thread.c diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 3ab31fa..a979cad 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -4,7 +4,6 @@ add_library(daw_core src/loop.c src/memory.c src/state.c - src/thread.c ${GLAD_HEADER} ) diff --git a/src/core/include/engine/core/thread.h b/src/core/include/engine/core/thread.h deleted file mode 100644 index 3d2e6b9..0000000 --- a/src/core/include/engine/core/thread.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef THREAD_H -#define THREAD_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef u64 thread_t; -typedef void*(thread_fn(void*)); - -thread_t thread_spawn(thread_fn* routine, void* arg); -void thread_join(thread_t thread); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/core/src/thread.c b/src/core/src/thread.c deleted file mode 100644 index 8c76e4a..0000000 --- a/src/core/src/thread.c +++ /dev/null @@ -1,38 +0,0 @@ -// The backend used :) -#include - -#include -#include - -thread_t thread_spawn(thread_fn* routine, void* arg) { - pthread_t t; - pthread_attr_t attr; - - if (pthread_attr_init(&attr)) { - ERROR("Failed to create thread attribute"); - return -1; - } - - if (pthread_create(&t, &attr, routine, arg)) { - ERROR("Failed to spawn new thread"); - } - - // This compile-time check should only be run once, but i am lazy and have - // spent too much time refactoring - if (sizeof(thread_t) < sizeof(pthread_t)) { - ERROR("THE SIZE AINT BIG ENOUGH!"); - exit(EXIT_FAILURE); - } - - if(pthread_attr_destroy(&attr)) { - ERROR("Failed to destroy thread attribute"); - } - // this little trick might cost us 40 years - return (thread_t)t; -} - -void thread_join(thread_t thread) { - if(pthread_join((pthread_t)thread, NULL)) { - ERROR("Unable to join thread"); - } -} -- cgit v1.3