repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
add rdoc.
[ruby-svn.git]
/
benchmark
/
bm_vm3_thread_mutex.rb
blob
649f1fddac8a89a39602a31926043c046214c13c
1
require 'thread'
2
m = Mutex.new
3
r = 0
4
max = 1000
5
(1..max).map{
6
Thread.new{
7
i=0
8
while i<max
9
i+=1
10
m.synchronize{
11
r += 1
12
}
13
end
14
}
15
}.each{|e|
16
e.join
17
}
18
raise r.to_s if r != max * max