win32: pthread_cond_init should return a value
This value is not checked, but it must return to match POSIX
There are issues in commit a311ebc2edcb90cd3e59c9d88e227b7609a29375:
win32: pthread_cond_wait should return a value
Commit not signed off
/submit
Submitted as [email protected]
To fetch this version into FETCH_HEAD:
git fetch https://github.com/gitgitgadget/git/ pr-git-2103/AZero13/pthread-v1
To fetch this version to local tag pr-git-2103/AZero13/pthread-v1:
git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2103/AZero13/pthread-v1
/submit
Submitted as [email protected]
To fetch this version into FETCH_HEAD:
git fetch https://github.com/gitgitgadget/git/ pr-git-2103/AZero13/pthread-v2
To fetch this version to local tag pr-git-2103/AZero13/pthread-v2:
git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2103/AZero13/pthread-v2
On the Git mailing list, Junio C Hamano wrote (reply to this):
"AZero13 via GitGitGadget" <[email protected]> writes:
> Subject: Re: [PATCH v2] win32: pthread_cond_wait should return a value
Is this mistitled? The patch text talks about cond_init(), not cond_wait(),
which is the theme for the other patch around SleepConditionVariableCS().
> From: Greg Funni <[email protected]>
>
> This value is not checked, but it must return to match POSIX
>
> Signed-off-by: Greg Funni <[email protected]>
> ---
> ...
> diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
> index e2b5c4f64c..000604cdf6 100644
> --- a/compat/win32/pthread.h
> +++ b/compat/win32/pthread.h
> @@ -34,7 +34,7 @@ typedef int pthread_mutexattr_t;
>
> #define pthread_cond_t CONDITION_VARIABLE
>
> -#define pthread_cond_init(a,b) InitializeConditionVariable((a))
> +#define pthread_cond_init(a,b) return_0((InitializeConditionVariable((a)), 0))
> #define pthread_cond_destroy(a) do {} while (0)
> #define pthread_cond_wait(a,b) return_0(SleepConditionVariableCS((a), (b), INFINITE))
> #define pthread_cond_signal WakeConditionVariable
>
> base-commit: 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed
Yes this was a typo. I apologize.
Yes this was a typo. I apologize.
@AZero13 you probably value the convenience of commenting on a PR. The Git project raises the bar, though, you have to follow the guidance in the "reply to this" link to get heard.
/submit
Submitted as [email protected]
To fetch this version into FETCH_HEAD:
git fetch https://github.com/gitgitgadget/git/ pr-git-2103/AZero13/pthread-v3
To fetch this version to local tag pr-git-2103/AZero13/pthread-v3:
git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2103/AZero13/pthread-v3
This patch series was integrated into seen via https://github.com/git/git/commit/b871fe5c4e3e0e828d7ceb370c1cdcaa876bc131.
On the Git mailing list, Junio C Hamano wrote (reply to this):
"AZero13 via GitGitGadget" <[email protected]> writes:
> From: Greg Funni <[email protected]>
>
> This value is not checked, but it must return to match POSIX
>
> Signed-off-by: Greg Funni <[email protected]>
> ---
> 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.
This patch series was integrated into seen via https://github.com/git/git/commit/061c72af17dbb57b3a9cc75967ba3ec70c36812a.
This branch is now known as gf/win32-pthread-cond-init.
This patch series was integrated into seen via https://github.com/git/git/commit/3c0725b0589fea975d71e553331a2b306d16f39c.
There was a status update in the "New Topics" section about the branch gf/win32-pthread-cond-init on the Git mailing list:
Emulation code clean-up. Will merge to 'next'? source: <[email protected]>
This patch series was integrated into seen via https://github.com/git/git/commit/796d489c93fa9966be508a6632dfc869e92987fe.
This patch series was integrated into seen via https://github.com/git/git/commit/6d839ca3fc09708268030b4ca725fb9075c0de9a.
This patch series was integrated into seen via https://github.com/git/git/commit/0003db9a18848d0e194474b226281506122beda3.
There was a status update in the "Cooking" section about the branch gf/win32-pthread-cond-init on the Git mailing list:
Emulation code clean-up. Will merge to 'next'? source: <[email protected]>
This patch series was integrated into seen via https://github.com/git/git/commit/af9aeec506662046a037678b3b8ea6e6a7ef14e4.
There was a status update in the "Cooking" section about the branch gf/win32-pthread-cond-init on the Git mailing list:
Emulation code clean-up. Will merge to 'next'? source: <[email protected]>
This patch series was integrated into seen via https://github.com/git/git/commit/923c79229f40a8fa1d04d173bd0b365180f1b8db.
There was a status update in the "Cooking" section about the branch gf/win32-pthread-cond-init on the Git mailing list:
Emulation code clean-up. Will merge to 'next'? source: <[email protected]>
This patch series was integrated into seen via https://github.com/git/git/commit/784ef72ce27f9406dc6bc05644b5a1d6e2198888.
On the Git mailing list, Junio C Hamano wrote (reply to this):
Junio C Hamano <[email protected]> writes:
> "AZero13 via GitGitGadget" <[email protected]> writes:
>
>> From: Greg Funni <[email protected]>
>>
>> This value is not checked, but it must return to match POSIX
>>
>> Signed-off-by: Greg Funni <[email protected]>
>> ---
>> 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.
This patch series was integrated into seen via https://github.com/git/git/commit/7516322387feb06b49633a57348fd08c522a6b68.
There was a status update in the "Cooking" section about the branch gf/win32-pthread-cond-init on the Git mailing list:
Emulation code clean-up. Will merge to 'next'. source: <[email protected]>
This patch series was integrated into seen via https://github.com/git/git/commit/1719ba42719396becfb0d472608fb9b66f3ae8f0.
This patch series was integrated into next via https://github.com/git/git/commit/202516d20c11395565196e3fced1546f451f969b.