[ruby-cvs:71533] normal:r64441 (trunk): thread_sync.c (rb_mutex_synchronize): only unlock if we own the mutex

normal at ruby-lang.org normal at ruby-lang.org
Sat Aug 18 15:33:49 JST 2018


normal	2018-08-18 15:33:49 +0900 (Sat, 18 Aug 2018)

  New Revision: 64441

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64441

  Log:
    thread_sync.c (rb_mutex_synchronize): only unlock if we own the mutex
    
    If an exception is raised inside Mutex#sleep (via ConditionVariable#wait),
    we cannot guarantee we can own the mutex in the ensure callback.
    
    However, who owns the mutex at that point does not matter.  What
    matters is the Mutex is usable after an exception occurs.
    
    * thread_sync.c (rb_mutex_synchronize): only unlock if we own the mutex
    
    * spec/ruby/library/conditionvariable/wait_spec.rb: only test lock
      usability after thread kill.  Who owns the lock at any
      particular moment is an implementation detail which we cannot
      easily guarantee.

  Modified files:
    trunk/spec/ruby/library/conditionvariable/wait_spec.rb
    trunk/thread_sync.c


More information about the ruby-cvs mailing list