diff --git a/tests/posix/common/src/pthread.c b/tests/posix/common/src/pthread.c index dea938a98a55..1705572e3b47 100644 --- a/tests/posix/common/src/pthread.c +++ b/tests/posix/common/src/pthread.c @@ -563,17 +563,15 @@ void test_posix_pthread_create_negative(void) void test_pthread_descriptor_leak(void) { - void *unused; pthread_t pthread1; pthread_attr_t attr; - zassert_ok(pthread_attr_init(&attr), NULL); - zassert_ok(pthread_attr_setstack(&attr, &stack_e[0][0], STACKS), NULL); - /* If we are leaking descriptors, then this loop will never complete */ for (size_t i = 0; i < CONFIG_MAX_PTHREAD_COUNT * 2; ++i) { - zassert_ok(pthread_create(&pthread1, &attr, create_thread1, NULL), + zassert_equal(0, pthread_attr_init(&attr), NULL); + zassert_equal(0, pthread_attr_setstack(&attr, &stack_e[0][0], STACKS), NULL); + zassert_equal(0, pthread_create(&pthread1, &attr, create_thread1, NULL), "unable to create thread %zu", i); - zassert_ok(pthread_join(pthread1, &unused), "unable to join thread %zu", i); + zassert_equal(0, pthread_join(pthread1, NULL), "unable to join thread %zu", i); } }