Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
ebd4a8b5
Commit
ebd4a8b5
authored
Feb 27, 2018
by
Paul McCarthy
🚵
Browse files
More iterations for mutex test
parent
71447b94
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_idle.py
View file @
ebd4a8b5
...
...
@@ -586,39 +586,41 @@ def test_mutex():
@
idle
.
mutex
def
method1
(
self
):
self
.
method1start
=
time
.
time
()
time
.
sleep
(
0.
5
)
time
.
sleep
(
0.
01
)
self
.
method1end
=
time
.
time
()
@
idle
.
mutex
def
method2
(
self
):
self
.
method2start
=
time
.
time
()
time
.
sleep
(
0.
5
)
time
.
sleep
(
0.
01
)
self
.
method2end
=
time
.
time
()
t
=
[
Thing
()]
for
i
in
range
(
200
):
def
thread1
():
t
[
0
].
method1
()
t
=
[
Thing
()]
def
thread
2
():
t
[
0
].
method
2
()
def
thread
1
():
t
[
0
].
method
1
()
for
i
in
range
(
20
):
def
thread2
():
t
[
0
].
method2
()
t
[
0
].
method1start
=
None
t
[
0
].
method2start
=
None
t
[
0
].
method1end
=
None
t
[
0
].
method2end
=
None
for
i
in
range
(
10
):
t1
=
threading
.
Thread
(
target
=
thread1
)
t2
=
threading
.
Thread
(
target
=
thread2
)
t
[
0
].
method1start
=
None
t
[
0
].
method2start
=
None
t
[
0
].
method1end
=
None
t
[
0
].
method2end
=
None
t1
.
start
()
t2
.
start
()
t1
.
join
()
t2
.
join
()
t1
=
threading
.
Thread
(
target
=
thread1
)
t2
=
threading
.
Thread
(
target
=
thread2
)
# Either t1 has to start and
# finish before t2 or vice versa
assert
(
t
[
0
].
method2start
>
t
[
0
].
method1end
or
t
[
0
].
method1start
>
t
[
0
].
method2end
)
t1
.
start
()
t2
.
start
()
t1
.
join
()
t2
.
join
()
# Either t1 has to start and
# finish before t2 or vice versa
assert
(
t
[
0
].
method2start
>
t
[
0
].
method1end
or
t
[
0
].
method1start
>
t
[
0
].
method2end
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment