From: "Đoàn Trần Công Danh" <congdanhqx@gmail•com>
To: Rose via GitGitGadget <gitgitgadget@gmail•com>
Cc: git@vger•kernel.org,
Rose <83477269+AtariDreams@users•noreply.github.com>,
Seija Kijin <doremylover123@gmail•com>
Subject: Re: [PATCH] win32: remove return_0 inline function
Date: Sat, 31 Dec 2022 09:51:50 +0700 [thread overview]
Message-ID: <Y6+jxkZjBMurBiw5@danh.dev> (raw)
In-Reply-To: <pull.1420.git.git.1672453222075.gitgitgadget@gmail.com>
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
prev parent reply other threads:[~2022-12-31 2:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y6+jxkZjBMurBiw5@danh.dev \
--to=congdanhqx@gmail$(echo .)com \
--cc=83477269+AtariDreams@users$(echo .)noreply.github.com \
--cc=doremylover123@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitgitgadget@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox