Issue #15310 has been updated by MSP-Greg (Greg L).


@normalperson Eric,

> would introduce no portability problems or performance overhead if I'm wrong...
> I could definitely use an extra set of eyes on this, though.

No idea about performance, but MinGW built & tested fine.
ruby 2.6.0dev (2018-11-20 trunk 65818) [x64-mingw32]

----------------------------------------
Bug #15310: [PATCH] thread_pthread.c: close race from UBF_TIMER and non-GVL-releasing thread
https://bugs.ruby-lang.org/issues/15310#change-74967

* Author: normalperson (Eric Wong)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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
timer fires.

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.


---Files--------------------------------
0001-thread_pthread.c-close-race-from-UBF_TIMER-and-non-G.patch (5.32 KB)


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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>