diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/core/include/engine/core/thread.h | 19 | ||||
| -rw-r--r-- | src/core/src/thread.c | 38 |
3 files changed, 0 insertions, 58 deletions
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 <engine/core/types.h> - -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 <pthread.h> - -#include <engine/core/logging.h> -#include <engine/core/thread.h> - -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"); - } -} |
