Hello,

I'm having trouble getting File.flock to work in non-blocking mode, in
ruby 1.9.0 (on CentOS 5).  The same code (show below in irb session)
works in ruby 1.8.5, but in 1.9.0 the attempt to lock in non-blocking
mode will block.  Has anyone else experienced this?  Any help or
suggestions would be much appreciated!

Lin

--- ruby 1.8.5 ---

[centos5]$ irb
irb(main):001:0> f = File.new('foo', 'w')
=> #<File:foo>
irb(main):002:0> f.flock(File::LOCK_EX)
=> 0
irb(main):003:0> f2 = File.new('foo', 'w')
=> #<File:foo>
irb(main):004:0> f2.flock(File::LOCK_EX | File::LOCK_NB)
=> false
irb(main):005:0> exit

--- ruby 1.9.0 ---

[centos5]$ irb-1.9.0
irb(main):001:0> f = File.new('foo', 'w')
=> #<File:foo>
irb(main):002:0> f.flock(File::LOCK_EX)
=> 0
irb(main):003:0> f2 = File.new('foo', 'w')
=> #<File:foo>
irb(main):004:0> f2.flock(File::LOCK_EX | File::LOCK_NB)
(...hangs, aborting with Ctl-C...)
IRB::Abort: abort then interrupt!!
        from /usr/local/lib/ruby/1.9.0/irb.rb:81:in `irb_abort'
        from /usr/local/lib/ruby/1.9.0/irb.rb:243:in `signal_handle'
        from /usr/local/lib/ruby/1.9.0/irb.rb:66:in `block in start'
        from (irb):4:in `flock'
        from (irb):4
        from /usr/local/lib/ruby/1.9.0/irb.rb:150:in `block (2 levels)
in eval_input'
        from /usr/local/lib/ruby/1.9.0/irb.rb:259:in `signal_status'
        from /usr/local/lib/ruby/1.9.0/irb.rb:147:in `block in
eval_input'
        from /usr/local/lib/ruby/1.9.0/irb.rb:146:in `eval_input'
        from /usr/local/lib/ruby/1.9.0/irb.rb:70:in `block in start'
        from /usr/local/lib/ruby/1.9.0/irb.rb:69:in `catch'
        from /usr/local/lib/ruby/1.9.0/irb.rb:69:in `start'
        from /usr/local/bin/irb-1.9.0:13:in `<main>'
irb(main):005:0> exit