summaryrefslogtreecommitdiff
path: root/auto_tests/toxav_many_test.c
diff options
context:
space:
mode:
authorpchk <pchk@mail.com>2016-12-11 05:52:17 +0300
committeriphydf <iphydf@users.noreply.github.com>2016-12-14 10:40:54 +0000
commit22fca79ad76147a07fcb3950a0a6ec1578ecc492 (patch)
tree82d0f51def81606f6d2aabae7952bf3593ada661 /auto_tests/toxav_many_test.c
parent7d2f2e4607080ebf5155b43050c62af4f14b9c88 (diff)
Fixed attempt to join detached threads
Diffstat (limited to 'auto_tests/toxav_many_test.c')
-rw-r--r--auto_tests/toxav_many_test.c16
1 files changed, 9 insertions, 7 deletions
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)
202 uint32_t index[] = { 1, 2, 3, 4, 5 }; 202 uint32_t index[] = { 1, 2, 3, 4, 5 };
203 Tox *Alice, *bootstrap, *Bobs[3]; 203 Tox *Alice, *bootstrap, *Bobs[3];
204 ToxAV *AliceAV, *BobsAV[3]; 204 ToxAV *AliceAV, *BobsAV[3];
205 void *retval;
205 206
206 CallControl AliceCC[3], BobsCC[3]; 207 CallControl AliceCC[3], BobsCC[3];
207 208
@@ -300,10 +301,6 @@ START_TEST(test_AV_three_calls)
300 (void) pthread_create(tids + 1, NULL, call_thread, tds + 1); 301 (void) pthread_create(tids + 1, NULL, call_thread, tds + 1);
301 (void) pthread_create(tids + 2, NULL, call_thread, tds + 2); 302 (void) pthread_create(tids + 2, NULL, call_thread, tds + 2);
302 303
303 (void) pthread_detach(tids[0]);
304 (void) pthread_detach(tids[1]);
305 (void) pthread_detach(tids[2]);
306
307 time_t start_time = time(NULL); 304 time_t start_time = time(NULL);
308 305
309 while (time(NULL) - start_time < 5) { 306 while (time(NULL) - start_time < 5) {
@@ -314,9 +311,14 @@ START_TEST(test_AV_three_calls)
314 c_sleep(20); 311 c_sleep(20);
315 } 312 }
316 313
317 (void) pthread_join(tids[0], NULL); 314 ck_assert(pthread_join(tids[0], &retval) == 0);
318 (void) pthread_join(tids[1], NULL); 315 ck_assert(retval == NULL);
319 (void) pthread_join(tids[2], NULL); 316
317 ck_assert(pthread_join(tids[1], &retval) == 0);
318 ck_assert(retval == NULL);
319
320 ck_assert(pthread_join(tids[2], &retval) == 0);
321 ck_assert(retval == NULL);
320 322
321 printf("Killing all instances\n"); 323 printf("Killing all instances\n");
322 toxav_kill(BobsAV[0]); 324 toxav_kill(BobsAV[0]);