Slide 1

Slide 1 text

த໺ڿਓ(.01&1"#0JOD ʲϖύϘºϓϨΠυʳ5FDI.FFUVQʙࣗಈςετɾ$*ฤʙ ฒߦɾฒྻॲཧͷςετ͸೉͍͠

Slide 2

Slide 2 text

8ΞϓϦέʔγϣϯΤϯδχΞ ػೳ։ൃνʔϜ த໺ڿਓ ͖͋ͬʔ !/","/0@"LJIJUP &$ࣄۀ෦Χϥʔϛʔγϣοϓάϧʔϓ IUUQBDLJOUPTIHJUIVCJP

Slide 3

Slide 3 text

Χϥʔϛʔγϣοϓ

Slide 4

Slide 4 text

܅΋ϖύϘͰಇ͔ͳ͍͔ʁ ࠷৽ͷ࠾༻৘ใΛνΣοΫˠ !QC@SFDSVJU

Slide 5

Slide 5 text

ฒߦɾฒྻॲཧͷςετ

Slide 6

Slide 6 text

ฒߦɾฒྻॲཧʁ Կʹ͍ͭͯͷൃදͳͷ͔Πϝʔδ͠΍͍͢Α͏ʹ ͸͡Ίʹ໌֬ʹ͓͖ͯ͠·͢ʂ

Slide 7

Slide 7 text

ฒߦɺฒྻɺඇಉظɺ෼ࢄʜ ϚϧνεϨου Ϛϧνϓϩηε ͪ͜Βʹ͍ͭͯͷൃදͰ͢ ෺ཧతʹಠཱͨ͠ෳ਺ͷϊʔυͰ ฒߦɾฒྻ

Slide 8

Slide 8 text

ͳͥฒߦɾฒྻॲཧΛςʔϚʹʁ

Slide 9

Slide 9 text

ฒߦɾฒྻॲཧɹ׆༻ͷྲྀΕ wϓϩηοαߴ଎Խ͔ΒϚϧνίΞ΁ wϦιʔεΛޮ཰తʹ׆༻͢ΔͨΊʹฒߦɾฒྻॲཧ͕஫໨͞ΕΔ wฒߦɾฒྻॲཧ͕ಘҙͳݴޠ͕࿩୊ʹ w3VCZձٞͰ͸(VJME͕ఏҊ͞Εͨ

Slide 10

Slide 10 text

1)1

Slide 11

Slide 11 text

4OJEFM εφΠσϧ IUUQTHJUIVCDPNBDLJOUPTITOJEFM खܰʹϚϧνϓϩηεͰ͖Δ ࢠϓϩηεͷॲཧ݁ՌΛड͚औΕΔ ϚελʔʗϫʔΧʔϞσϧ 1)1Ҏ্

Slide 12

Slide 12 text

ϓϧϦΫΤετ׻ܴʂ IUUQTHJUIVCDPNBDLJOUPTITOJEFM

Slide 13

Slide 13 text

ຊ୊

Slide 14

Slide 14 text

ฒߦɾฒྻॲཧͷ೉͠͞Λςετͷ؍఺Ͱ

Slide 15

Slide 15 text

λΠϛϯά໰୊

Slide 16

Slide 16 text

ϓϩμΫτίʔυ class Foo def run Thread.new do # ৭ʑ @done = true end # ৭ʑ end end

Slide 17

Slide 17 text

ςετίʔυ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run sleep 1 assert_true foo.done end end

Slide 18

Slide 18 text

ςετίʔυ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run sleep 1 assert_true foo.done end end ෆ҆ఆ

Slide 19

Slide 19 text

εςοϓ ॲཧΛ੾Γग़͢

Slide 20

Slide 20 text

ϓϩμΫτίʔυ͜ΕΛʜ class Foo def run Thread.new do # ৭ʑ @done = true end # ৭ʑ end end

Slide 21

Slide 21 text

ϓϩμΫτίʔυ͜͏ʂ class Foo def run Thread.new do # ৭ʑ @done = self.do end # ৭ʑ end def do # ৭ʑ true end end

Slide 22

Slide 22 text

ςετίʔυ͜ΕΛʜ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run sleep 1 assert_true foo.done end end

Slide 23

Slide 23 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 24

Slide 24 text

ඇಉظͳ෦෼Λ ಉظॲཧͱͯ͠ςετͰ͖ΔΑ͏ʹͳͬͨʂ

Slide 25

Slide 25 text

)VNCMF0CKFDUύλʔϯ Y6OJU5FTU1BUUFSOT$I

Slide 26

Slide 26 text

͕͔ͩ͠͠

Slide 27

Slide 27 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 28

Slide 28 text

εςοϓ ϝοηʔδύογϯάΛ࢖͏

Slide 29

Slide 29 text

lϝϞϦͷ্ͰγΣΞ͢ΔͷͰ͸ͳ͘ ίϛϡχέʔγϣϯͰγΣΞ͢Δz 4J[FE2VFVFΛ࢖ͬͯ ͦΕͬΆ͍͜ͱΛ΍Γ·͢

Slide 30

Slide 30 text

ϓϩμΫτίʔυ͜ΕΛʜ 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 ஌ݟΛڞ༗͍͖ͯ͠·͠ΐ͏ʂʂ̍