diff options
author | <andrewsh@debian.org> | 2016-07-05 15:22:32 +0200 |
---|---|---|
committer | <andrewsh@debian.org> | 2016-07-05 15:22:32 +0200 |
commit | cd4e6862b9b46c5a86bd5aea69fb853650bafe52 (patch) | |
tree | 2689a7c405f673e112eb3346eeb2588ea683ed0f /src/libmowgli/thread/thread.h | |
parent | 89ea71be5b5b98cf7869ba1059e4b6c60cd82c85 (diff) | |
parent | 9e0c7e865c04dcbcdb6bd74a2e3ab379dfd8dd8b (diff) |
Merge experimental version.
Diffstat (limited to 'src/libmowgli/thread/thread.h')
-rw-r--r-- | src/libmowgli/thread/thread.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/libmowgli/thread/thread.h b/src/libmowgli/thread/thread.h index f063217..88939eb 100644 --- a/src/libmowgli/thread/thread.h +++ b/src/libmowgli/thread/thread.h @@ -28,15 +28,20 @@ #ifdef MOWGLI_OS_UNIX_TYPE # include <thread.h> # define MOWGLI_FEATURE_HAVE_NATIVE_THREADS -# define MOWGLI_NATIVE_THREAD_DECL(name) thread_t (name) +# ifdef MOWGLI_OS_THREADS_SOLARIS +# define MOWGLI_NATIVE_THREAD_DECL(name) pthread_t(name) +# else +# define MOWGLI_NATIVE_THREAD_DECL(name) thread_t(name) +# endif #elif defined MOWGLI_OS_WIN # define MOWGLI_FEATURE_HAVE_NATIVE_THREADS -# define MOWGLI_NATIVE_THREAD_DECL(name) HANDLE (name) +# define MOWGLI_NATIVE_THREAD_DECL(name) HANDLE(name) #else # include <pthread.h> #endif -typedef struct { +typedef struct +{ #ifdef MOWGLI_FEATURE_HAVE_NATIVE_THREADS MOWGLI_NATIVE_THREAD_DECL(thread); #else @@ -55,10 +60,11 @@ typedef void *(*mowgli_thread_start_fn_t)(mowgli_thread_t *thread, void *userdat * portability. Creating, ending, killing and cleanup functions are presently implemented, * and cover approximately 99.999% of uses of thread APIs. --nenolod */ -typedef struct { +typedef struct +{ int (*thread_create)(mowgli_thread_t *thread, mowgli_thread_start_fn_t start_fn, void *userdata); void (*thread_exit)(mowgli_thread_t *thread); - void *(*thread_join)(mowgli_thread_t *thread); + void *(*thread_join)(mowgli_thread_t * thread); void (*thread_kill)(mowgli_thread_t *thread); void (*thread_destroy)(mowgli_thread_t *thread); } mowgli_thread_ops_t; @@ -69,10 +75,10 @@ void *mowgli_thread_join(mowgli_thread_t *thread); void mowgli_thread_kill(mowgli_thread_t *thread); void mowgli_thread_destroy(mowgli_thread_t *thread); -typedef enum { +typedef enum +{ MOWGLI_THREAD_POLICY_DEFAULT, MOWGLI_THREAD_POLICY_DISABLED, } mowgli_thread_policy_t; #endif - |