Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin J. Thompson
Tor
Commits
9daae1b3
Unverified
Commit
9daae1b3
authored
6 years ago
by
teor
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'tor-github/pr/331' into maint-0.2.9
parents
2e74edb5
7a0ff5be
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/bug27073
+4
-0
4 additions, 0 deletions
changes/bug27073
src/test/test_threads.c
+19
-11
19 additions, 11 deletions
src/test/test_threads.c
with
23 additions
and
11 deletions
changes/bug27073
0 → 100644
+
4
−
0
View file @
9daae1b3
o Minor bugfixes (testing):
- Revise the "conditionvar_timeout" test so that it succeeds even
on heavily loaded systems where the test threads are not scheduled
within 200 msec. Fixes bug 27073; bugfix on 0.2.6.3-alpha.
This diff is collapsed.
Click to expand it.
src/test/test_threads.c
+
19
−
11
View file @
9daae1b3
...
...
@@ -234,25 +234,33 @@ test_threads_conditionvar(void *arg)
if
(
timeout
)
{
ti
->
tv
=
&
msec100
;
}
#define SPIN_UNTIL(condition,sleep_msec) \
while (1) { \
tor_mutex_acquire(ti->mutex); \
if (condition) { \
break; \
} \
tor_mutex_release(ti->mutex); \
tor_sleep_msec(sleep_msec); \
}
spawn_func
(
cv_test_thr_fn_
,
ti
);
spawn_func
(
cv_test_thr_fn_
,
ti
);
spawn_func
(
cv_test_thr_fn_
,
ti
);
spawn_func
(
cv_test_thr_fn_
,
ti
);
tor_mutex_acquire
(
ti
->
mutex
);
SPIN_UNTIL
(
ti
->
n_threads
==
4
,
10
);
time_t
started_at
=
time
(
NULL
);
ti
->
addend
=
7
;
ti
->
shutdown
=
1
;
tor_cond_signal_one
(
ti
->
cond
);
tor_mutex_release
(
ti
->
mutex
);
#define SPIN() \
while (1) { \
tor_mutex_acquire(ti->mutex); \
if (ti->addend == 0) { \
break; \
} \
tor_mutex_release(ti->mutex); \
}
SPIN_UNTIL(ti->addend == 0, 0)
SPIN
();
...
...
@@ -279,8 +287,9 @@ test_threads_conditionvar(void *arg)
if
(
!
timeout
)
{
tt_int_op
(
ti
->
n_shutdown
,
==
,
4
);
}
else
{
tor_sleep_msec
(
200
);
tor_mutex_acquire
(
ti
->
mutex
);
const
int
GIVE_UP_AFTER_SEC
=
30
;
SPIN_UNTIL
((
ti
->
n_timeouts
==
2
||
time
(
NULL
)
>=
started_at
+
GIVE_UP_AFTER_SEC
),
10
);
tt_int_op
(
ti
->
n_shutdown
,
==
,
2
);
tt_int_op
(
ti
->
n_timeouts
,
==
,
2
);
tor_mutex_release
(
ti
->
mutex
);
...
...
@@ -301,4 +310,3 @@ struct testcase_t thread_tests[] = {
&
passthrough_setup
,
(
void
*
)
"tv"
},
END_OF_TESTCASES
};
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