diff options
author | Patrick Steinhardt <ps@pks.im> | 2016-06-20 17:20:13 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2016-06-20 19:49:34 +0200 |
commit | 139bffa074c7a74af92ee9c97d1e876acfc8dcd3 (patch) | |
tree | e034fef2f7eb708cbc7503d447e4664b27026012 /src/win32 | |
parent | 20d078dff166592b853f186096148c9b32262454 (diff) | |
download | libgit2-139bffa074c7a74af92ee9c97d1e876acfc8dcd3.tar.gz |
threads: split up OS-dependent thread-condition code
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/pthread.c | 12 | ||||
-rw-r--r-- | src/win32/pthread.h | 10 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/win32/pthread.c b/src/win32/pthread.c index abf047025..9ce062ab8 100644 --- a/src/win32/pthread.c +++ b/src/win32/pthread.c @@ -91,12 +91,8 @@ int git_mutex_unlock(git_mutex *mutex) return 0; } -int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) +int git_cond_init(git_cond *cond) { - /* We don't support non-default attributes. */ - if (attr) - return EINVAL; - /* This is an auto-reset event. */ *cond = CreateEventW(NULL, FALSE, FALSE, NULL); assert(*cond); @@ -106,7 +102,7 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) return *cond ? 0 : ENOMEM; } -int pthread_cond_destroy(pthread_cond_t *cond) +int git_cond_free(git_cond *cond) { BOOL closed; @@ -121,7 +117,7 @@ int pthread_cond_destroy(pthread_cond_t *cond) return 0; } -int pthread_cond_wait(pthread_cond_t *cond, git_mutex *mutex) +int git_cond_wait(git_cond *cond, git_mutex *mutex) { int error; DWORD wait_result; @@ -142,7 +138,7 @@ int pthread_cond_wait(pthread_cond_t *cond, git_mutex *mutex) return git_mutex_lock(mutex); } -int pthread_cond_signal(pthread_cond_t *cond) +int git_cond_signal(git_cond *cond) { BOOL signaled; diff --git a/src/win32/pthread.h b/src/win32/pthread.h index 9d314c89e..35cb810e7 100644 --- a/src/win32/pthread.h +++ b/src/win32/pthread.h @@ -29,7 +29,7 @@ typedef int pthread_attr_t; typedef int pthread_rwlockattr_t; typedef CRITICAL_SECTION git_mutex; -typedef HANDLE pthread_cond_t; +typedef HANDLE git_cond; typedef struct { void *Ptr; } GIT_SRWLOCK; @@ -52,10 +52,10 @@ int git_mutex_free(git_mutex *); int git_mutex_lock(git_mutex *); int git_mutex_unlock(git_mutex *); -int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *); -int pthread_cond_destroy(pthread_cond_t *); -int pthread_cond_wait(pthread_cond_t *, git_mutex *); -int pthread_cond_signal(pthread_cond_t *); +int git_cond_init(git_cond *); +int git_cond_free(git_cond *); +int git_cond_wait(git_cond *, git_mutex *); +int git_cond_signal(git_cond *); int pthread_num_processors_np(void); |