[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master 1/2] testsuite: Only free the main mutex when and if all the worker threads are done



Author: Peter Palfrader <peter@xxxxxxxxxxxxx>
Date: Mon, 12 Apr 2010 22:49:58 +0200
Subject: testsuite: Only free the main mutex when and if all the worker threads are done
Commit: a02923122e597e833a987dc38a3b0b8a62e0b122

---
 changes/weasel-testuite-thread-fixes |    3 +++
 src/or/test.c                        |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
 create mode 100644 changes/weasel-testuite-thread-fixes

diff --git a/changes/weasel-testuite-thread-fixes b/changes/weasel-testuite-thread-fixes
new file mode 100644
index 0000000..8fed729
--- /dev/null
+++ b/changes/weasel-testuite-thread-fixes
@@ -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.
diff --git a/src/or/test.c b/src/or/test.c
index 6b7066c..652a4ee 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -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"));
-- 
1.6.5