Skip to content

Commit 0b9639c

Browse files
Adding timeout to new test to prevent stall if created test thread doesn't complete.
1 parent 3ebca29 commit 0b9639c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/test_dh.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ int test_dh_pgen_pkey(ENGINE *e, void *data)
342342

343343
#if !defined(WE_SINGLE_THREADED) && defined(_WIN32)
344344

345+
#define TEST_MT_TIMEOUT 5000 /* Multi-threaded test timeout (ms) */
346+
345347
typedef struct {
346348
ENGINE* e;
347349
EVP_PKEY* params;
@@ -366,8 +368,7 @@ int test_dh_key_gen_multithreaded(ENGINE* e, EVP_PKEY* params)
366368
int err = 1;
367369

368370
thread = CreateThread(NULL, 0, DhKeyGenThreadFunc, &vars, 0, NULL);
369-
if (thread) {
370-
WaitForSingleObject(thread, INFINITE);
371+
if (thread && (WaitForSingleObject(thread, TEST_MT_TIMEOUT) == WAIT_OBJECT_0)) {
371372
err = (GetExitCodeThread(thread, &threadErr) == 0 ? 1 : threadErr);
372373
CloseHandle(thread);
373374
}

0 commit comments

Comments
 (0)