testsuite: Only free the main mutex when and if all the worker threads are done

This commit is contained in:
Peter Palfrader 2010-04-12 22:49:58 +02:00 committed by Nick Mathewson
parent 0324d3b0ec
commit a02923122e
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,3 @@
o Minor bugfixes:
- Testsuite: In the util/threads test no longer free the test_mutex
before all worker threads have finished.

View File

@ -2356,13 +2356,14 @@ test_util_threads(void)
}
tor_mutex_release(_thread_test_mutex);
}
tor_mutex_free(_thread_test_mutex);
tor_mutex_acquire(_thread_test_start1);
tor_mutex_release(_thread_test_start1);
tor_mutex_acquire(_thread_test_start2);
tor_mutex_release(_thread_test_start2);
tor_mutex_free(_thread_test_mutex);
if (timedout) {
printf("\nTimed out: %d %d", t1_count, t2_count);
test_assert(strmap_get(_thread_test_strmap, "thread 1"));