[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / benchmark / vm_thread_mutex1.rb
blob66e42c85e1d40ea3e4be76439b761565390769a7
1 # one thread, one mutex (no contention)
3 require 'thread'
4 m = Thread::Mutex.new
5 r = 0
6 max = 2000
7 lmax = max * max
8 (1..1).map{
9   Thread.new{
10     i = 0
11     while i<lmax
12       i += 1
13       m.synchronize{
14         r += 1
15       }
16     end
17   }
18 }.each{|e|
19   e.join
21 raise r.to_s if r != max * max