Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tor
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
debian
tor
Commits
5e679acc
Commit
5e679acc
authored
14 years ago
by
Peter Palfrader
Committed by
Nick Mathewson
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
testsuite: Prevent the main thread from starving the worker threads
parent
a0292312
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/weasel-testuite-thread-fixes
+5
-0
5 additions, 0 deletions
changes/weasel-testuite-thread-fixes
src/or/test.c
+9
-0
9 additions, 0 deletions
src/or/test.c
with
14 additions
and
0 deletions
changes/weasel-testuite-thread-fixes
+
5
−
0
View file @
5e679acc
o Minor bugfixes:
- Testsuite: In the util/threads test no longer free the test_mutex
before all worker threads have finished.
- Testsuite: The master thread could starve the worker threads quite
badly on certain systems, causing them to run only partially in
the allowed window. This resulted in test failures. Now the master
thread sleeps occasionally for a few microseconds while the two
worker-threads compete for the mutex.
This diff is collapsed.
Click to expand it.
src/or/test.c
+
9
−
0
View file @
5e679acc
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment