Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / bench / shootout / message.ruby
blobe38981bd17375f4b184c98ec0bfac2435f760ab1
1 # The Computer Language Shootout
2 # http://shootout.alioth.debian.org/
4 # Contributed by Jesse Millikan
6 require 'thread'
8 N = ARGV[0].to_i
9 next_q = last_q = SizedQueue.new(1)
11 500.times {
12 q = SizedQueue.new(1)
13 q2 = next_q
14 Thread.new{
15 i = N
16 while i > 0
17 q2.push(q.pop+1)
18 i -= 1
19 end
21 next_q = q
24 Thread.new{N.times{next_q.push(0)}}
26 t = 0
27 N.times{t+=last_q.pop}
28 puts t