win32: remove return_0 inline function
PATCH 1/1 win32: remove return_0 inline function
From: Seija Kijin <[email protected]>
The macro works on its own without the helper function
---
win32: remove return_0 inline function
The macro works on its own without the helper function
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1420%2FAtariDreams%2Fcondition-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1420/AtariDreams/condition-v1
Pull-Request: https://github.com/git/git/pull/1420
compat/win32/pthread.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
compat/win32/pthread.h +4 -4
@@ -18,10 +18,10 @@*/ #define pthread_mutex_t CRITICAL_SECTION -static inline int return_0 (int i) { -return 0 ; +static inline int return_i (int i) { +return i; } -#define pthread_mutex_init (a,b) return_0((InitializeCriticalSection((a)), 0)) +#define pthread_mutex_init (a,b) return_i((InitializeCriticalSection((a)), 0))#define pthread_mutex_destroy (a) DeleteCriticalSection((a))#define pthread_mutex_lock EnterCriticalSection#define pthread_mutex_unlock LeaveCriticalSection
@@ -36,7 +36,7 @@ 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_wait (a,b) SleepConditionVariableCS((a), (b), INFINITE)#define pthread_cond_signal WakeConditionVariable#define pthread_cond_broadcast WakeAllConditionVariable
base-commit: 6bae53b138a1f38d8887f6b46d17661357a1468b
Signature · 1 line
gitgitgadget
Quoted 3 lines · Rose via GitGitGadget
From: Seija Kijin <[email protected]>
The macro works on its own without the helper function
NACK
compat/win32/pthread.h line 24
Quoted 9 lines
#define
pthread_mutex_tCRITICAL_SECTIONcompat/win32/pthread.h +3
-3-static inline int return_0 (int i) { -return 0 ; +static inline int return_i (int i) { +return i; } -#define pthread_mutex_init (a,b) return_0((InitializeCriticalSection((a)), 0)) +#define pthread_mutex_init (a,b) return_i((InitializeCriticalSection((a)), 0))
This change does nothing and harmless in its own.
compat/win32/pthread.h typedef int pthread_mutexattr_t; · line 39
Quoted 9 lines
#define
pthread_mutex_destroy(a)DeleteCriticalSection((a)) #definepthread_mutex_lockEnterCriticalSection #definepthread_mutex_unlockLeaveCriticalSectioncompat/win32/pthread.h +1
-1@@ -36,7 +36,7 @@ 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_wait (a,b) SleepConditionVariableCS((a), (b), INFINITE)
But this is not,pthread_cond_wait return 0 on success, otherwise error number. SleepConditionVariableCS return non-zero on success, 0 on failure.
IOW, this change is broken on Windows.
Signature · 1 line
Danh