thread variable test refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cc09ba4699
commit
34d9c3d5c7
@ -13,7 +13,7 @@ assert_finish 1, %q{
|
|||||||
w.write "a"
|
w.write "a"
|
||||||
}, '[ruby-dev:31866]'
|
}, '[ruby-dev:31866]'
|
||||||
|
|
||||||
assert_equal "[[nil, 1, 1, nil, nil], [nil, 2, 2, nil]]", %q{
|
assert_equal "[[nil, 1, 3, 3, 1, nil, nil], [nil, 2, 2, nil]]", %q{
|
||||||
def tvar(var, val)
|
def tvar(var, val)
|
||||||
old = Thread.current[var]
|
old = Thread.current[var]
|
||||||
begin
|
begin
|
||||||
@ -26,24 +26,18 @@ assert_equal "[[nil, 1, 1, nil, nil], [nil, 2, 2, nil]]", %q{
|
|||||||
ary1 = []
|
ary1 = []
|
||||||
ary2 = []
|
ary2 = []
|
||||||
fb = Fiber.new {
|
fb = Fiber.new {
|
||||||
ary2 << Thread.current[:v]
|
ary2 << Thread.current[:v]; tvar(:v, 2) {
|
||||||
tvar(:v, 2) {
|
ary2 << Thread.current[:v]; Fiber.yield
|
||||||
ary2 << Thread.current[:v]
|
ary2 << Thread.current[:v]; }
|
||||||
Fiber.yield
|
ary2 << Thread.current[:v]; Fiber.yield
|
||||||
ary2 << Thread.current[:v]
|
|
||||||
}
|
|
||||||
ary2 << Thread.current[:v]
|
|
||||||
Fiber.yield
|
|
||||||
ary2 << Thread.current[:v]
|
ary2 << Thread.current[:v]
|
||||||
}
|
}
|
||||||
ary1 << Thread.current[:v]
|
ary1 << Thread.current[:v]; tvar(:v,1) {
|
||||||
tvar(:v,1) {
|
ary1 << Thread.current[:v]; tvar(:v,3) {
|
||||||
ary1 << Thread.current[:v]
|
ary1 << Thread.current[:v]; fb.resume
|
||||||
fb.resume
|
ary1 << Thread.current[:v]; }
|
||||||
ary1 << Thread.current[:v]
|
ary1 << Thread.current[:v]; }
|
||||||
}
|
ary1 << Thread.current[:v]; fb.resume
|
||||||
ary1 << Thread.current[:v]
|
ary1 << Thread.current[:v];
|
||||||
fb.resume
|
|
||||||
ary1 << Thread.current[:v]
|
|
||||||
[ary1, ary2]
|
[ary1, ary2]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user