git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3] win32: remove handling for impossible cases in win32_pthread_join

From
AGAZero13 via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 18, 2025, 15:47 UTC
Message-ID
<pull.2102.v3.git.git.1763480854213.gitgitgadget@gmail.com>
In-Reply-To
<pull.2102.v2.git.git.1763480720264.gitgitgadget@gmail.com>
From: Greg Funni <gfunni234@gmail.com>
WAIT_FAILED is the only real possible error here.

WAIT_TIMEOUT would not be returned as the INFINITE is given to the call.

WAIT_ABANDONED would be returned if the handle pointed to a mutex object that was not released by the thread that owned the mutex object before the owning thread terminated.

WAIT_IO_COMPLETION would not be returned because we pass FALSE so the wait is not alertable.

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-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2102/AZero13/patch-1-v3
Pull-Request: https://github.com/git/git/pull/2102
Range-diff vs v2:
 1:  e0d6b15093 = 1:  20f943570f win32: remove handling for impossible cases in win32_pthread_join
 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
Previous: AZero13 via GitGitGadgetNext: Junio C Hamano
Message 4 of 5 in “win32: remove handling for impossible cases in win32_pthread_join”
  1. win32: remove handling for impossible cases in win32_pthread_joinAZero13 via GitGitGadget, Nov 18, 2025
  2. Junio C HamanoNov 18, 2025
  3. win32: remove handling for impossible cases in win32_pthread_joinAZero13 via GitGitGadget, Nov 18, 2025
  4. win32: remove handling for impossible cases in win32_pthread_joinAZero13 via GitGitGadget, Nov 18, 2025
  5. Junio C HamanoNov 18, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.