ϓϩμΫτίʔυ͜ΕΛʜ
class Foo
def run
Thread.new do
# ৭ʑ
@done = self.do
end
# ৭ʑ
end
def do
# ৭ʑ
true
end
end
Slide 31
Slide 31 text
ϓϩμΫτίʔυ͜͏ʂ
class Foo
def initialize
@done = SizedQueue.new(1)
end
def run
Thread.new do
# ৭ʑ
@done << self.do
end
# ৭ʑ
end
… (ུ) …
end
Slide 32
Slide 32 text
ςετίʔυ͜ΕΛʜ
class FooTest < Test::Unit::TestCase
def test_run
(foo = Foo.new).run
sleep 1
assert_true foo.done
end
def test_do
assert_true Foo.new.do
end
end
Slide 33
Slide 33 text
ςετίʔυ͜͏ʂ
class FooTest < Test::Unit::TestCase
def test_run
(foo = Foo.new).run
assert_true foo.done.pop
end
def test_do
assert_true Foo.new.do
end
end
Slide 34
Slide 34 text
λΠϛϯά
ղܾʂ
Slide 35
Slide 35 text
ଞʹ
w εϥΠυͰ൚༻తͳςΫχοΫͷ͝հͰ͕ͨ͠
w ݴޠϑϨʔϜϫʔΫ͕ఏڙ͢Δศརػೳ͋Γ·͢
w ྫ(Pݴޠͷ3BDF%FUFDUPS
Slide 36
Slide 36 text
·ͱΊ
Slide 37
Slide 37 text
·ͱΊ
w ฒߦɾฒྻॲཧͷ͠͞ʹςετͰର߅Ͱ͖Δ
w ಛ༗ͷϓϥΫςΟε͕͋Δ
w ݟΛڞ༗͍͖ͯ͠·͠ΐ͏ʂʂ̍