diff options
author | Peter Palfrader <peter@palfrader.org> | 2010-04-13 00:10:56 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-04-12 18:15:20 -0400 |
commit | 5e679acc72a2648c38a3ee3a2b05cd5b75906568 (patch) | |
tree | 97ea878548b53a42a3c4491e85ca5da9ee6dd3e6 /src/or/test.c | |
parent | a02923122e597e833a987dc38a3b0b8a62e0b122 (diff) | |
download | tor-5e679acc72a2648c38a3ee3a2b05cd5b75906568.tar.gz tor-5e679acc72a2648c38a3ee3a2b05cd5b75906568.zip |
testsuite: Prevent the main thread from starving the worker threads
Diffstat (limited to 'src/or/test.c')
-rw-r--r-- | src/or/test.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c index 652a4ee44f..14ba953544 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -2326,6 +2326,11 @@ test_util_threads(void) char *s1 = NULL, *s2 = NULL; int done = 0, timedout = 0; time_t started; +#ifndef MS_WINDOWS + struct timeval tv; + tv.tv_sec=0; + tv.tv_usec=10; +#endif #ifndef TOR_IS_MULTITHREADED /* Skip this test if we aren't threading. We should be threading most * everywhere by now. */ @@ -2355,6 +2360,10 @@ test_util_threads(void) timedout = done = 1; } tor_mutex_release(_thread_test_mutex); +#ifndef MS_WINDOWS + /* Prevent the main thread from starving the worker threads. */ + select(0, NULL, NULL, NULL, &tv); +#endif } tor_mutex_acquire(_thread_test_start1); |