summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/kit/thread.c14
-rw-r--r--source/kit/thread.h5
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