[PATCH] msvcp120/tests: Compare thread IDs in test_thrd, not thread handles

Piotr Caban piotr at codeweavers.com
Tue Dec 7 05:48:43 CST 2021


Hi Alex,

On 12/7/21 08:04, Alex Henrie wrote:
> diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
> index 495ee9dd6fb..3241e577b88 100644
> --- a/dlls/msvcp120/tests/msvcp120.c
> +++ b/dlls/msvcp120/tests/msvcp120.c
> @@ -2093,8 +2093,8 @@ static void test_thrd(void)
>       tb = p__Thrd_current();
>       ok(ta.id == tb.id, "got a %d b %d\n", ta.id, tb.id);
>       ok(ta.id == GetCurrentThreadId(), "expected %d, got %d\n", GetCurrentThreadId(), ta.id);
> -    /* these can be different if new threads are created at same time */
> -    ok(ta.hnd == tb.hnd, "got a %p b %p\n", ta.hnd, tb.hnd);
> +    /* the handles can be different if new threads are created at same time, but the IDs are always the same */
> +    ok(GetThreadId(ta.hnd) == GetThreadId(tb.hnd), "got a %d b %d\n", GetThreadId(ta.hnd), GetThreadId(tb.hnd));
The function returns closed handles so it's not really valid to pass 
them to any function. The GetThreadId returns error for both ta.hnd and 
tb.hnd. I would suggest to remove the test or check if ta.hnd != NULL 
and tb.hnd != NULL.

Thanks,
Piotr



More information about the wine-devel mailing list