title: Multi-threading in Ruby (MRI)
body: <p>According to GIL implementation in Ruby (MRI), the code below must fail by printing a message more than one time. But it doesn't, it always print it one time:</p>
  
  <pre><code>class Sheep
    def initialize
      @shorn = false
    end
  
    def shorn?
      @shorn
    end
  
    def shorn!
      puts "shearing..."
      @shorn = true
    end
  end
  
  s = Sheep.new
  55.times.map do
    Thread.new { s.shorn! unless s.shorn? }
  end.each(&amp;:join)
  </code></pre>
  
  <p>How come?</p>
  
  <pre><code>$ ruby --version
  ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
  </code></pre>