>>>>> "M" == Morris, Chris <chris.morris / snelling.com> writes:

M> I have need for a thread safe Array, so I threw one together -- but in
M> trying to test it, I've been unable to come up with a script that breaks on
M> plain ol' Array. Is it thread safe? If not, how can I break it?

 What do you call safe ?

pigeon% cat b.rb
#!/usr/bin/ruby
a = [1, 2, 3]
t = Thread.new do
   a.each do |x|
      p x
      Thread.pass
   end
end
Thread.new do
   a[0,0] = [12, 24]
end
t.join
pigeon% 

pigeon% b.rb
1
24
1
2
3
pigeon% 


Guy Decoux