From b985e0ac007290dd5aa9f01d646acb6ab3f72fb7 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Sun, 14 Aug 2022 04:55:00 +0400 Subject: test --- source/kit/thread.c | 14 +++++++------- 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 # include +# include 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 -- cgit v1.2.3