All of lore.kernel.org
 help / color / mirror / Atom feed
From: "AZero13 via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: AZero13 <gfunni234@gmail.com>, AZero13 <gfunni234@gmail.com>
Subject: [PATCH] win32: remove handling for impossible cases in win32_pthread_join
Date: Tue, 18 Nov 2025 01:00:06 +0000	[thread overview]
Message-ID: <pull.2102.git.git.1763427606138.gitgitgadget@gmail.com> (raw)

From: AZero13 <gfunni234@gmail.com>

WAIT_FAILED is the only real possible error here.

Signed-off-by: Greg Funni <gfunni234@gmail.com>
---
    win32: remove handling for impossible cases in win32_pthread_join
    
    WAIT_FAILED is the only real possible error here.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2102%2FAZero13%2Fpatch-1-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2102/AZero13/patch-1-v1
Pull-Request: https://github.com/git/git/pull/2102

 compat/win32/pthread.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/compat/win32/pthread.c b/compat/win32/pthread.c
index 58980a529c..54c43b4146 100644
--- a/compat/win32/pthread.c
+++ b/compat/win32/pthread.c
@@ -37,20 +37,14 @@ int pthread_create(pthread_t *thread, const void *attr UNUSED,
 
 int win32_pthread_join(pthread_t *thread, void **value_ptr)
 {
-	DWORD result = WaitForSingleObject(thread->handle, INFINITE);
-	switch (result) {
-	case WAIT_OBJECT_0:
-		if (value_ptr)
-			*value_ptr = thread->arg;
-		CloseHandle(thread->handle);
-		return 0;
-	case WAIT_ABANDONED:
-		CloseHandle(thread->handle);
-		return EINVAL;
-	default:
-		/* the wait failed, so do not detach */
+	if (WaitForSingleObjectEx(thread->handle, INFINITE, FALSE) == WAIT_FAILED)
 		return err_win_to_posix(GetLastError());
-	}
+
+	if (value_ptr)
+		*value_ptr = thread->arg;
+
+	CloseHandle(thread->handle);
+	return 0;
 }
 
 pthread_t pthread_self(void)

base-commit: 9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed
-- 
gitgitgadget

             reply	other threads:[~2025-11-18  1:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18  1:00 AZero13 via GitGitGadget [this message]
2025-11-18  2:11 ` [PATCH] win32: remove handling for impossible cases in win32_pthread_join Junio C Hamano
2025-11-18 15:45 ` [PATCH v2] " AZero13 via GitGitGadget
2025-11-18 15:47   ` [PATCH v3] " AZero13 via GitGitGadget
2025-11-18 17:02   ` [PATCH v2] " Junio C Hamano

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=pull.2102.git.git.1763427606138.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=gfunni234@gmail.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.