summaryrefslogtreecommitdiff
path: root/src/win32/pthread.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2014-06-20 14:42:16 +0200
committerVicent Marti <tanoku@gmail.com>2014-06-20 14:42:16 +0200
commit28f087c8642ff9c8dd6964e101e6d8539db6281a (patch)
tree3518d1bf420e92c964bed03074575d8a1db88654 /src/win32/pthread.h
parent4b0a36e881506a02b43a4ae3c19c93c919b36eeb (diff)
parent1589aa0c4d48fb130d8a5db28c45cd3d173cde6d (diff)
downloadlibgit2-28f087c8642ff9c8dd6964e101e6d8539db6281a.tar.gz
libgit2 v0.21.0v0.21.0
Diffstat (limited to 'src/win32/pthread.h')
-rw-r--r--src/win32/pthread.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/win32/pthread.h b/src/win32/pthread.h
index af5b121f0..e4826ca7f 100644
--- a/src/win32/pthread.h
+++ b/src/win32/pthread.h
@@ -16,13 +16,19 @@
# define GIT_RESTRICT __restrict__
#endif
+typedef struct {
+ HANDLE thread;
+ void *(*proc)(void *);
+ void *param;
+ void *result;
+} git_win32_thread;
+
typedef int pthread_mutexattr_t;
typedef int pthread_condattr_t;
typedef int pthread_attr_t;
typedef int pthread_rwlockattr_t;
typedef CRITICAL_SECTION pthread_mutex_t;
-typedef HANDLE pthread_t;
typedef HANDLE pthread_cond_t;
typedef struct { void *Ptr; } GIT_SRWLOCK;
@@ -36,13 +42,26 @@ typedef struct {
#define PTHREAD_MUTEX_INITIALIZER {(void*)-1}
-int pthread_create(
- pthread_t *GIT_RESTRICT thread,
- const pthread_attr_t *GIT_RESTRICT attr,
- void *(*start_routine)(void*),
- void *GIT_RESTRICT arg);
+int git_win32__thread_create(
+ git_win32_thread *GIT_RESTRICT,
+ const pthread_attr_t *GIT_RESTRICT,
+ void *(*) (void *),
+ void *GIT_RESTRICT);
+
+int git_win32__thread_join(
+ git_win32_thread *,
+ void **);
+
+#ifdef GIT_THREADS
-int pthread_join(pthread_t, void **);
+typedef git_win32_thread git_thread;
+
+#define git_thread_create(git_thread_ptr, attr, start_routine, arg) \
+ git_win32__thread_create(git_thread_ptr, attr, start_routine, arg)
+#define git_thread_join(git_thread_ptr, status) \
+ git_win32__thread_join(git_thread_ptr, status)
+
+#endif
int pthread_mutex_init(
pthread_mutex_t *GIT_RESTRICT mutex,