diff options
author | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-14 04:55:00 +0400 |
---|---|---|
committer | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-14 04:55:00 +0400 |
commit | b985e0ac007290dd5aa9f01d646acb6ab3f72fb7 (patch) | |
tree | 3f6904e349e4b69903e417b43605e2e329324e6d | |
parent | 8583a79099c0d66d81b98cbdc39bc06e04347d1a (diff) | |
download | kit-b985e0ac007290dd5aa9f01d646acb6ab3f72fb7.zip |
test
-rw-r--r-- | source/kit/thread.c | 14 | ||||
-rw-r--r-- | source/kit/thread.h | 5 |
2 files changed, 10 insertions, 9 deletions
diff --git a/source/kit/thread.c b/source/kit/thread.c index 471cdea..66ff050 100644 --- a/source/kit/thread.c +++ b/source/kit/thread.c @@ -3,14 +3,14 @@ #ifdef _MSC_VER # include "atomic.h" -# include <windows.h> # include <stdlib.h> +# include <windows.h> typedef struct { - HANDLE thread; - kit_thread_routine routine; - void *user_data; - void *return_value; + HANDLE thread; + kit_thread_routine_ routine; + void *user_data; + void *return_value; } thread_data; DWORD __stdcall run_thread_(void *p) { @@ -18,8 +18,8 @@ DWORD __stdcall run_thread_(void *p) { data->return_value = data->routine(data->user_data); } -int pthread_create(pthread_t *new_thread, void *attrs, - void *(*routine)(void *), void *user_data) { +int pthread_create(pthread_t *new_thread, void *attrs, + kit_thread_routine_ routine, void *user_data) { thread_data *data = (thread_data *) malloc(sizeof(thread_data)); if (data == NULL) return -1; diff --git a/source/kit/thread.h b/source/kit/thread.h index a1138ae..0fab0c8 100644 --- a/source/kit/thread.h +++ b/source/kit/thread.h @@ -8,10 +8,11 @@ extern "C" { #ifndef _MSC_VER # include "pthread.h" #else +typedef void *(*kit_thread_routine_)(void *); typedef void *pthread_t; -int pthread_create(pthread_t *new_thread, void *attrs, - void *(*routine)(void *), void *user_data); +int pthread_create(pthread_t *new_thread, void *attrs, + kit_thread_routine_ routine, void *user_data); void *pthread_join(pthread_t thread, void *return_value); #endif |