Issue #7505 has been updated by tarui (Masaya Tarui).


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

mutex=Mutex.new
Thread.new{
  mutex.synchronize{
    begin
      sleep 1
      mutex.sleep
    ensure
      ?????解???
    end
  }
}
mutex.syncronize{
  sleep 10
}

mutex.sleep???mutex???????????????????????C-c????????????mutex???確?????????????????????確??????????????????????
??????mutex???確????????????Thread???死??????????????????????????mutex??解???????????
mutex.sleep?????mutex???????????????????????????????????????

??????mutex??????????????????????????修正????????????????????????????????????
????????1,2,3?????????????????mutex?????????????ensure????????????????????????

----------------------------------------
Feature #7505: Mutex#owned? ???????????設
https://bugs.ruby-lang.org/issues/7505#change-34366

Author: kosaki (Motohiro KOSAKI)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: next minor


以????????????????????????????????????????

Thread.async_interrupt_timing(Object => :on_blocking) {
  begin
??????mutex = Mutex.new
    mutex.synchronize {
       sleep 1
       condvar.wait mutex
  ???}
  ensure
    ?????解??????????
  end
}

mutex.synchronize??中???Ctrl-c?????????????????????込?????????????????????????????????????

1) sleep
2) mutex.sleep?????中???native_sleep?condvar.signal ?????
3) mutex.sleep?????中???rb_mutex_lock(condvar.signal??起????????????????mutex???????????????使?中?????????????mutex?????

???????????????????mutex??????????????ensure???????????????????mutex???????????????ensure????????????????????????????????????????Ruby????????????????????????????????????????ruby???????? workaround????????????????????????????????????

???????正?????????????段????????????????????????????????????Mutex#owned? ???????????設??????????????????????????Mutex#locked? ?????????????????????????????????????????true???????????

???????????轡?

https://gist.github.com/4195632

以???????POSIX???????pthread_cond_wait????????????????????????????????????????????????Mutex???lock???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Ctrl-C??????????????????akr????????好?????????????????????




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