[PATCH] thread_pthread.c: close race from UBF_TIMER and non-GVL-releasing thread
thread_pthread.c: close race from UBF_TIMER and non-GVL-releasing thread
A Ruby thread may run without releasing the GVL if there is no
contention. And there may be no contention because another
thread missed its wakeup and needs to rely on ubf_list for
wakeups. So we need to ensure the Ruby thread can relinquish
GVL and trigger ubf_list wakeups to target thread when the POSIX
Thus, we trigger a timeslice on SIGVTALRM when triggered by
UBF_TIMER (we do not want excessive switching overhead on every
SIGVTALRM signal, either).
Note: I'm pretty sure this is necessary, correct and would introduce no
portability problems or performance overhead if I'm wrong...
I could definitely use an extra set of eyes on this, though.