diff options
| author | Greg Funni <gfunni234@gmail.com> | 2025-11-18 15:41:54 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-20 14:45:26 -0800 |
| commit | 2367c6bcd600882d0ea70d4f654c8cfa5c1f53ac (patch) | |
| tree | a2dfc8f1e67fef67202d35051a9164a1a5cd31a0 /compat/win32 | |
| parent | 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed (diff) | |
| download | git-2367c6bcd600882d0ea70d4f654c8cfa5c1f53ac.tar.gz | |
win32: return error if SleepConditionVariableCS fails
If it fails, return an error.
Signed-off-by: Greg Funni <gfunni234@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/win32')
| -rw-r--r-- | compat/win32/pthread.c | 7 | ||||
| -rw-r--r-- | compat/win32/pthread.h | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/compat/win32/pthread.c b/compat/win32/pthread.c index 58980a529c..7e93146963 100644 --- a/compat/win32/pthread.c +++ b/compat/win32/pthread.c @@ -59,3 +59,10 @@ pthread_t pthread_self(void) t.tid = GetCurrentThreadId(); return t; } + +int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +{ + if (SleepConditionVariableCS(cond, mutex, INFINITE) == 0) + return err_win_to_posix(GetLastError()); + return 0; +} diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h index e2b5c4f64c..859e1d9021 100644 --- a/compat/win32/pthread.h +++ b/compat/win32/pthread.h @@ -36,7 +36,6 @@ typedef int pthread_mutexattr_t; #define pthread_cond_init(a,b) InitializeConditionVariable((a)) #define pthread_cond_destroy(a) do {} while (0) -#define pthread_cond_wait(a,b) return_0(SleepConditionVariableCS((a), (b), INFINITE)) #define pthread_cond_signal WakeConditionVariable #define pthread_cond_broadcast WakeAllConditionVariable @@ -64,6 +63,8 @@ int win32_pthread_join(pthread_t *thread, void **value_ptr); #define pthread_equal(t1, t2) ((t1).tid == (t2).tid) pthread_t pthread_self(void); +int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); + static inline void NORETURN pthread_exit(void *ret) { _endthreadex((unsigned)(uintptr_t)ret); |
