Skip to content

Commit 238a9df

Browse files
Seija Kijingitster
authored andcommitted
win32: close handles of threads that have been joined
After the thread terminates, the handle to the original thread should be closed. This change makes win32_pthread_join POSIX compliant. Signed-off-by: Seija Kijin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 23a6a12 commit 238a9df

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compat/win32/pthread.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ int win32_pthread_join(pthread_t *thread, void **value_ptr)
4242
case WAIT_OBJECT_0:
4343
if (value_ptr)
4444
*value_ptr = thread->arg;
45+
CloseHandle(thread->handle);
4546
return 0;
4647
case WAIT_ABANDONED:
48+
CloseHandle(thread->handle);
4749
return EINVAL;
4850
default:
51+
/* the wait failed, so do not detach */
4952
return err_win_to_posix(GetLastError());
5053
}
5154
}

0 commit comments

Comments
 (0)