Skip to content

Commit 23d36a7

Browse files
author
Christopher Friedt
committed
tests: posix: common: add a small delay in pthread_descriptor_leak
The `aborted _current back from dead` error may appear in this particular test under Qemu (and in particular Qemu SMP) systems. A small delay between `pthread_create()` and `pthread_join()` is sufficient to mitigate the issue. Signed-off-by: Christopher Friedt <[email protected]>
1 parent 4a91429 commit 23d36a7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/posix/common/src/pthread.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,12 @@ ZTEST(posix_apis, test_pthread_descriptor_leak)
594594
for (size_t i = 0; i < CONFIG_MAX_PTHREAD_COUNT * 2; ++i) {
595595
zassert_ok(pthread_create(&pthread1, &attr, create_thread1, NULL),
596596
"unable to create thread %zu", i);
597+
/*
598+
* k_msleep() should not be necessary, but it is added as a workaround
599+
* for #56163 and #58116, which identified race conditions on some
600+
* platforms.
601+
*/
602+
k_msleep(100);
597603
zassert_ok(pthread_join(pthread1, NULL), "unable to join thread %zu", i);
598604
}
599605
}

0 commit comments

Comments
 (0)