{"thread":{"id":"64501","subject":"[PATCH] win32: return error if SleepConditionVariableCS fails","startedAt":"2025-11-18T00:59:55Z","lastAt":"2025-11-18T15:41:57Z","messageCount":2,"participants":["AZero13 via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"530867","messageId":"pull.2104.git.git.1763427591884.gitgitgadget@gmail.com","threadId":"64501","inReplyTo":null,"subject":"[PATCH] win32: return error if SleepConditionVariableCS fails","fromName":"AZero13 via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-11-18T00:59:51Z","receivedAt":"2025-11-18T00:59:55Z","isPatch":true,"sender":{"key":"name:AZero13","avatar":null},"body":"From: AZero13 <gfunni234@gmail.com>\n\nIf it fails, return an error.\n\nSigned-off-by: Greg Funni <gfunni234@gmail.com>\n---\n    win32: return error if SleepConditionVariableCS fails\n    \n    If it fails, return an error.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2104%2FAZero13%2Fsleep-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2104/AZero13/sleep-v1\nPull-Request: https://github.com/git/git/pull/2104\n\n compat/win32/pthread.c | 7 +++++++\n compat/win32/pthread.h | 3 ++-\n 2 files changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/win32/pthread.c b/compat/win32/pthread.c\nindex 58980a529c..7e93146963 100644\n--- a/compat/win32/pthread.c\n+++ b/compat/win32/pthread.c\n@@ -59,3 +59,10 @@ pthread_t pthread_self(void)\n \tt.tid = GetCurrentThreadId();\n \treturn t;\n }\n+\n+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)\n+{\n+\tif (SleepConditionVariableCS(cond, mutex, INFINITE) == 0)\n+\t\treturn err_win_to_posix(GetLastError());\n+\treturn 0;\n+}\ndiff --git a/compat/win32/pthread.h b/compat/win32/pthread.h\nindex e2b5c4f64c..859e1d9021 100644\n--- a/compat/win32/pthread.h\n+++ b/compat/win32/pthread.h\n@@ -36,7 +36,6 @@ typedef int pthread_mutexattr_t;\n \n #define pthread_cond_init(a,b) InitializeConditionVariable((a))\n #define pthread_cond_destroy(a) do {} while (0)\n-#define pthread_cond_wait(a,b) return_0(SleepConditionVariableCS((a), (b), INFINITE))\n #define pthread_cond_signal WakeConditionVariable\n #define pthread_cond_broadcast WakeAllConditionVariable\n \n@@ -64,6 +63,8 @@ int win32_pthread_join(pthread_t *thread, void **value_ptr);\n #define pthread_equal(t1, t2) ((t1).tid == (t2).tid)\n pthread_t pthread_self(void);\n \n+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);\n+\n static inline void NORETURN pthread_exit(void *ret)\n {\n \t_endthreadex((unsigned)(uintptr_t)ret);\n\nbase-commit: 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed\n-- \ngitgitgadget\n"},{"id":"530904","messageId":"pull.2104.v2.git.git.1763480514065.gitgitgadget@gmail.com","threadId":"64501","inReplyTo":"pull.2104.git.git.1763427591884.gitgitgadget@gmail.com","subject":"[PATCH v2] win32: return error if SleepConditionVariableCS fails","fromName":"AZero13 via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-11-18T15:41:54Z","receivedAt":"2025-11-18T15:41:57Z","isPatch":true,"sender":{"key":"name:AZero13","avatar":null},"body":"From: Greg Funni <gfunni234@gmail.com>\n\nIf it fails, return an error.\n\nSigned-off-by: Greg Funni <gfunni234@gmail.com>\n---\n    win32: return error if SleepConditionVariableCS fails\n    \n    If it fails, return an error.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2104%2FAZero13%2Fsleep-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2104/AZero13/sleep-v2\nPull-Request: https://github.com/git/git/pull/2104\n\nRange-diff vs v1:\n\n 1:  35384a6aa3 ! 1:  7bdcd55664 win32: return error if SleepConditionVariableCS fails\n     @@\n       ## Metadata ##\n     -Author: AZero13 <gfunni234@gmail.com>\n     +Author: Greg Funni <gfunni234@gmail.com>\n      \n       ## Commit message ##\n          win32: return error if SleepConditionVariableCS fails\n\n\n compat/win32/pthread.c | 7 +++++++\n compat/win32/pthread.h | 3 ++-\n 2 files changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/win32/pthread.c b/compat/win32/pthread.c\nindex 58980a529c..7e93146963 100644\n--- a/compat/win32/pthread.c\n+++ b/compat/win32/pthread.c\n@@ -59,3 +59,10 @@ pthread_t pthread_self(void)\n \tt.tid = GetCurrentThreadId();\n \treturn t;\n }\n+\n+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)\n+{\n+\tif (SleepConditionVariableCS(cond, mutex, INFINITE) == 0)\n+\t\treturn err_win_to_posix(GetLastError());\n+\treturn 0;\n+}\ndiff --git a/compat/win32/pthread.h b/compat/win32/pthread.h\nindex e2b5c4f64c..859e1d9021 100644\n--- a/compat/win32/pthread.h\n+++ b/compat/win32/pthread.h\n@@ -36,7 +36,6 @@ typedef int pthread_mutexattr_t;\n \n #define pthread_cond_init(a,b) InitializeConditionVariable((a))\n #define pthread_cond_destroy(a) do {} while (0)\n-#define pthread_cond_wait(a,b) return_0(SleepConditionVariableCS((a), (b), INFINITE))\n #define pthread_cond_signal WakeConditionVariable\n #define pthread_cond_broadcast WakeAllConditionVariable\n \n@@ -64,6 +63,8 @@ int win32_pthread_join(pthread_t *thread, void **value_ptr);\n #define pthread_equal(t1, t2) ((t1).tid == (t2).tid)\n pthread_t pthread_self(void);\n \n+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);\n+\n static inline void NORETURN pthread_exit(void *ret)\n {\n \t_endthreadex((unsigned)(uintptr_t)ret);\n\nbase-commit: 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed\n-- \ngitgitgadget\n"}]}