From 5b59985459eb54b95291500a70bceeb4c68b3f78 Mon Sep 17 00:00:00 2001 From: actboy168 Date: Tue, 3 Mar 2026 13:17:46 +0800 Subject: [PATCH] fixes bug when worker>64 --- src/thread.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/thread.h b/src/thread.h index 7011943..cdd626e 100644 --- a/src/thread.h +++ b/src/thread.h @@ -84,8 +84,14 @@ thread_start(struct thread * threads, int n, int usemainthread) { static inline void thread_join(void *handle, int n) { HANDLE *thread_handle = (HANDLE *)handle; - WaitForMultipleObjects(n, thread_handle, TRUE, INFINITE); int i; + for (i = 0; i < n; i += MAXIMUM_WAIT_OBJECTS) { + int size = n - i; + if (size > MAXIMUM_WAIT_OBJECTS) { + size = MAXIMUM_WAIT_OBJECTS; + } + WaitForMultipleObjects(size, &thread_handle[i], TRUE, INFINITE); + } for (i=0;i