* [PATCH] win32: remove return_0 inline function
@ 2022-12-31 2:20 Rose via GitGitGadget
2022-12-31 2:51 ` Đoàn Trần Công Danh
0 siblings, 1 reply; 2+ messages in thread
From: Rose via GitGitGadget @ 2022-12-31 2:20 UTC (permalink / raw)
To: git; +Cc: Rose, Seija Kijin
From: Seija Kijin <doremylover123@gmail.com>
The macro works on its own without the helper function
Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
win32: remove return_0 inline function
The macro works on its own without the helper function
Signed-off-by: Seija Kijin doremylover123@gmail.com
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(-)
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 737983d00ba..18aa2e1241d 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -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
--
gitgitgadget
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] win32: remove return_0 inline function
2022-12-31 2:20 [PATCH] win32: remove return_0 inline function Rose via GitGitGadget
@ 2022-12-31 2:51 ` Đoàn Trần Công Danh
0 siblings, 0 replies; 2+ messages in thread
From: Đoàn Trần Công Danh @ 2022-12-31 2:51 UTC (permalink / raw)
To: Rose via GitGitGadget; +Cc: git, Rose, Seija Kijin
On 2022-12-31 02:20:21+0000, Rose via GitGitGadget <gitgitgadget@gmail.com> wrote:
> From: Seija Kijin <doremylover123@gmail.com>
>
> The macro works on its own without the helper function
NACK
> #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))
This change does nothing and harmless in its own.
> #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)
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.
--
Danh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-31 2:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-31 2:20 [PATCH] win32: remove return_0 inline function Rose via GitGitGadget
2022-12-31 2:51 ` Đoàn Trần Công Danh
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).