Hi,

At Wed, 5 Jun 2002 15:45:30 +0900,
ts wrote:
> t>  and with this ?
> 
>  and the same for FLIP3 :-(

Making flip variables static causes a problem with threads.

$ cat t.rb
#! /usr/bin/ruby
def flip2(n)
  Thread.pass
  sub = proc {|x| "#{x if (x==1)..(x==3)}"}
  proc {|x| "#{x if (x==1)..(x==2)}"}.call(1) if n == 1
  [sub.call(0), sub.call(1), sub.call(2), sub.call(3), sub.call(4)]
end

t1 = Thread.new {flip2(0)}
t2 = Thread.new {flip2(1)}
p t1.value
p t2.value

$ ./i686-linux/miniruby t.rb
["", "1", "2", "3", ""]
["0", "1", "2", "3", ""]

-- 
Nobu Nakada