summaryrefslogtreecommitdiff
path: root/tests/run-threaded.c
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@gnupg.org>2019-06-05 16:07:43 +0200
committerAndre Heinecke <aheinecke@gnupg.org>2019-06-05 16:20:31 +0200
commit9bbe15ebbc41533fa219d5b3017a26a75bc72731 (patch)
treeba616cf81ea546a4dfa364dba84b80b974fe4c57 /tests/run-threaded.c
parent8f9f3224aac78ce9d54e19e73acf7ab659787168 (diff)
downloadgpgme-9bbe15ebbc41533fa219d5b3017a26a75bc72731.tar.gz
tests,w32: Fix thread creation in run-threaded
* tests/run-threaded.c (create_thread): Check proper return value and not return value of CloseHandle.
Diffstat (limited to 'tests/run-threaded.c')
-rw-r--r--tests/run-threaded.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/run-threaded.c b/tests/run-threaded.c
index 02524b22..7041da8d 100644
--- a/tests/run-threaded.c
+++ b/tests/run-threaded.c
@@ -56,12 +56,14 @@ static int mem_only;
static void
create_thread (THREAD_RET (*func) (void *), void *arg)
{
- running_threads++;
- if (CloseHandle (CreateThread (NULL, 0, func, arg, 0, NULL)))
+ HANDLE hd = CreateThread (NULL, 0, func, arg, 0, NULL);
+ if (hd == INVALID_HANDLE_VALUE)
{
fprintf (stderr, "Failed to create thread!\n");
exit (1);
}
+ running_threads++;
+ CloseHandle (hd);
}
#else