tests,w32: Fix thread creation in run-threaded

* tests/run-threaded.c (create_thread): Check proper return
value and not return value of CloseHandle.
This commit is contained in:
Andre Heinecke 2019-06-05 16:07:43 +02:00
parent 8f9f3224aa
commit 9bbe15ebbc
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -56,12 +56,14 @@ static int mem_only;
static void static void
create_thread (THREAD_RET (*func) (void *), void *arg) create_thread (THREAD_RET (*func) (void *), void *arg)
{ {
running_threads++; HANDLE hd = CreateThread (NULL, 0, func, arg, 0, NULL);
if (CloseHandle (CreateThread (NULL, 0, func, arg, 0, NULL))) if (hd == INVALID_HANDLE_VALUE)
{ {
fprintf (stderr, "Failed to create thread!\n"); fprintf (stderr, "Failed to create thread!\n");
exit (1); exit (1);
} }
running_threads++;
CloseHandle (hd);
} }
#else #else