Ruby ã® Monitor 㨠ConditionVariable ã®ä½¿ãæ¹ ãªããªãããã£ã¦ãæ¥æ¬èªã®è³æãè¦ã¤ãããªãã£ãã®ã§èªåã§åããã¦ã¿ãã(ãããè½åä½ã) ã¾ãThreadã®ç´åå require "thread" require "monitor" moni = Monitor.new val = 0 Thread.new { 3.times { puts "thread1 start: #{val}" val+=1 sleep 0.1 puts "thread1 end: #{val}" } } Thread.new { 3.times { puts "thread2 start: #{val}" val+=1 sleep 0.1 puts "thread2 end: #{val}" } } sleep çµæã¯ä»¥ä¸ã®éãã start > end, start > en
{{#tags}}- {{label}}
{{/tags}}