From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: "AZero13 via GitGitGadget" <gitgitgadget@gmail.com>,
AZero13 <gfunni234@gmail.com>
Subject: Re: [PATCH v3] win32: pthread_cond_init should return a value
Date: Sun, 07 Dec 2025 09:18:31 +0900 [thread overview]
Message-ID: <xmqqwm2znnzc.fsf@gitster.g> (raw)
In-Reply-To: <xmqqecps5f8u.fsf@gitster.g> (Junio C. Hamano's message of "Thu, 20 Nov 2025 17:46:57 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> "AZero13 via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> From: Greg Funni <gfunni234@gmail.com>
>>
>> This value is not checked, but it must return to match POSIX
>>
>> Signed-off-by: Greg Funni <gfunni234@gmail.com>
>> ---
>> win32: pthread_cond_init should return a value
>>
>> This value is not checked, but it must return to match POSIX
>> ...
>> -#define pthread_cond_init(a,b) InitializeConditionVariable((a))
>> +#define pthread_cond_init(a,b) return_0((InitializeConditionVariable((a)), 0))
>
> This is tricky and I like it.
>
> Because InitializeConditionVariable() returns void, and return_0()
> is defined as such:
>
> static inline int return_0(int i) { return 0; }
>
> you cannot directly pass InitializeConditionVariable() to it, so you
> use a comma operator and pass 0 to return_0(). Because the type of
> the comma operator with mixed operands is the type of the rightmost
> operand, the type of "InitializeConditionVariable((a)), 0" is type
> of "0", so return_0() would happily take it as an int, and returns
> 0.
>
> This should work correctly, but it still is tricky and yucky.
>
> You may not have to use return_0(), but OK.
>
> Will queue. Thanks.
As I do not do Windows, I was hoping somebody more clueful than
myself on the platform would give an Ack to this patch, but we saw
nothing. I'll mark the topic for 'next'. I do not anticipate
breakage but if there were something fishy, hopefully we will hear
quickly enough.
prev parent reply other threads:[~2025-12-07 0:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 0:59 [PATCH] win32: pthread_cond_wait should return a value AZero13 via GitGitGadget
2025-11-18 15:42 ` [PATCH v2] " AZero13 via GitGitGadget
2025-11-18 18:17 ` Junio C Hamano
2025-11-20 21:43 ` [PATCH v3] win32: pthread_cond_init " AZero13 via GitGitGadget
2025-11-21 1:46 ` Junio C Hamano
2025-12-07 0:18 ` Junio C Hamano [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=xmqqwm2znnzc.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=gfunni234@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).