diff options
author | kelly.leahy <kelly.leahy> | 2011-05-08 12:32:35 -0700 |
---|---|---|
committer | kelly.leahy <kelly.leahy> | 2011-05-08 12:32:35 -0700 |
commit | 16a5c3046595284c1f2f8b9eb8621d76239e4b61 (patch) | |
tree | 3749a2f1c5c6ea6b2a7f017cad36dec07ab4901b /src/win32/pthread.c | |
parent | cfba137707ba334b8f7917ca6261f842fa11a60e (diff) | |
download | libgit2-16a5c3046595284c1f2f8b9eb8621d76239e4b61.tar.gz |
Fix bug in the way pthead_mutex_t was being destroyed in win32.
Win32 critical section objects (CRITICAL_SECTION) are not kernel objects.
Only kernel objects are destroyed by using CloseHandle. Critical sections
are supposed to be deleted with the DeleteCriticalSection API
(http://msdn.microsoft.com/en-us/library/ms682552(VS.85).aspx).
Diffstat (limited to 'src/win32/pthread.c')
-rw-r--r-- | src/win32/pthread.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/win32/pthread.c b/src/win32/pthread.c index f47364a76..7e17b6bdf 100644 --- a/src/win32/pthread.c +++ b/src/win32/pthread.c @@ -48,16 +48,15 @@ int pthread_join(pthread_t thread, void **value_ptr) int pthread_mutex_init(pthread_mutex_t *GIT_RESTRICT mutex, const pthread_mutexattr_t *GIT_RESTRICT GIT_UNUSED(mutexattr)) { - GIT_UNUSED_ARG(mutexattr); + GIT_UNUSED_ARG(mutexattr); InitializeCriticalSection(mutex); return 0; } int pthread_mutex_destroy(pthread_mutex_t *mutex) { - int ret; - ret = CloseHandle(mutex); - return -(!ret); + DeleteCriticalSection(mutex); + return 0; } int pthread_mutex_lock(pthread_mutex_t *mutex) |