Issue #5355 has been updated by kosaki (Motohiro KOSAKI).


????????? #5195?????????? timeout module?????????????????????exception??????????????????????????? ensure???????足???????????????????解決????????????????????????????????????????????????
----------------------------------------
Bug #5355: Sync_m???Bug #5195???Bug #5258????????????
https://bugs.ruby-lang.org/issues/5355#change-29228

Author: Glass_saga (Masaki Matsushita)
Status: Closed
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: lib
Target version: 2.0.0
ruby -v: ruby 1.9.4dev (2011-09-20 trunk 33301) [x86_64-linux]


=begin
Sync_m????Bug #5195???Bug #5258??????????????????????????

 require 'sync'
 
 class Foo; include Sync_m; end
 
 foo = Foo.new
 foo.sync_lock(:EX)
 
 t = Thread.new { foo.sync_lock(:EX) }
 
 nil until t.stop?
 p foo.sync_waiting
 
 t.wakeup
 
 nil until t.stop?
 p foo.sync_waiting

??????????????????????

 [#<Thread:0x00000001936858 sleep>]
 [#<Thread:0x00000001936858 sleep>, #<Thread:0x00000001936858 sleep>]
 
??????????????起?????????????????@sync_waiting?????Thread.current???push??????????????????
???????次????????????????????

 require 'sync'
 
 class Foo; include Sync_m; end
 
 foo = Foo.new
 foo.sync_lock(:SH)
 
 t = Thread.start do
 foo.sync_lock(:SH)
 foo.sync_lock(:EX)
 end
 
 nil until t.stop?
 p foo.sync_upgrade_waiting
 p foo.sync_waiting
 
 t.wakeup
 
 nil until t.stop?
 p foo.sync_upgrade_waiting
 p foo.sync_waiting

?????????????????????????????

 [[#<Thread:0x000000015e04d8 sleep>, 1]]
 []
 [[#<Thread:0x000000015e04d8 sleep>, 1]]
 [#<Thread:0x000000015e04d8 sleep>]
 
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????@sync_upgrade_waiting???push?????????????????????????????????????????????起?????????
@sync_upgrade_waiting??????@sync_waiting???Thread.current???push?????????????

??????? http://redmine.ruby-lang.org/issues/5258#note-2 ?????????????????????????????????????????????????????????????????????????????
@waiting???push??????????????????????????置?????????????????????

 require 'sync'
 
 class Foo; include Sync_m; end
 
 foo = Foo.new
 foo.sync_lock(:EX)
 
 t = Thread.new { foo.sync_lock(:EX) }
 
 nil until t.stop?
 p foo.sync_waiting
 t.raise
 nil while t.alive?
 p foo.sync_waiting
 
??????:

 [#<Thread:0x00000000e498f0 sleep>]
 [#<Thread:0x00000000e498f0 dead>]

以?????????解決??????patch???添????????????

=end


-- 
http://bugs.ruby-lang.org/