From 22fca79ad76147a07fcb3950a0a6ec1578ecc492 Mon Sep 17 00:00:00 2001 From: pchk Date: Sun, 11 Dec 2016 05:52:17 +0300 Subject: Fixed attempt to join detached threads --- auto_tests/toxav_many_test.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'auto_tests/toxav_many_test.c') diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index a351129a..59e4f94b 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c @@ -202,6 +202,7 @@ START_TEST(test_AV_three_calls) uint32_t index[] = { 1, 2, 3, 4, 5 }; Tox *Alice, *bootstrap, *Bobs[3]; ToxAV *AliceAV, *BobsAV[3]; + void *retval; CallControl AliceCC[3], BobsCC[3]; @@ -300,10 +301,6 @@ START_TEST(test_AV_three_calls) (void) pthread_create(tids + 1, NULL, call_thread, tds + 1); (void) pthread_create(tids + 2, NULL, call_thread, tds + 2); - (void) pthread_detach(tids[0]); - (void) pthread_detach(tids[1]); - (void) pthread_detach(tids[2]); - time_t start_time = time(NULL); while (time(NULL) - start_time < 5) { @@ -314,9 +311,14 @@ START_TEST(test_AV_three_calls) c_sleep(20); } - (void) pthread_join(tids[0], NULL); - (void) pthread_join(tids[1], NULL); - (void) pthread_join(tids[2], NULL); + ck_assert(pthread_join(tids[0], &retval) == 0); + ck_assert(retval == NULL); + + ck_assert(pthread_join(tids[1], &retval) == 0); + ck_assert(retval == NULL); + + ck_assert(pthread_join(tids[2], &retval) == 0); + ck_assert(retval == NULL); printf("Killing all instances\n"); toxav_kill(BobsAV[0]); -- cgit v1.2.3