From: SASADA Koichi Date: 2017-05-08T08:38:31+09:00 Subject: [ruby-core:81026] Re: [Ruby trunk Feature#13517] [PATCH] reduce rb_mutex_t size from 160 to 80 bytes on 64-bit On 2017/05/08 8:08, Eric Wong wrote: > Back to your original question. THREAD_RUNNABLE is possible > if somebody uses Thread#run: > > require 'thread' > m = Mutex.new > th = Thread.new do > sleep 0.1 # wait for main thread to get lock > m.synchronize do > sleep > end > end > > m.synchronize do > sleep 0.2 # wait for th to block on m.synchronize > th.run > end I also confirm that this code set `THREAD_RUNNABLE`. However, `th` waits locking forever, current `Thread#run` should be bug. mmmm. But not so serious because it is only small period (maybe as you know). We should modify later. > I am not sure about other statuses. Maybe exit/GC can trigger > THREAD_KILLED, the mutex_free->rb_mutex_unlock_th call chain > looks like it might due to GC ordering. Anyways, I will add > comments here when I commit. I think adding rb_bug() guard is good to know the flow of such situation. -- // SASADA Koichi at atdot dot net Unsubscribe: