From: Eric Wong Date: 2018-07-28T01:40:09+00:00 Subject: [ruby-core:88143] Re: [Ruby trunk Feature#14717] [PATCH] thread: allow disabling preempt eregontp@gmail.com wrote: > Is this the same as `Thread.new { Thread.handle_interrupt(Exception => :never) { ... } }`? > What's the difference? No, current thread switching does not use interrupts in the same sense (no Exception objects are created). However, I suppose it could be implemented internally using ec->interrupt_mask. > Is preemption as in threads giving control (and the GIL) to > another is still possible with `Thread#preemptible = true` or > not? If not, then I think this feature requires a GIL to be > implemented (because `Thread#preemptible = true` is called > after Thread creation) and I am very strongly against it. Giving control to other threads still happens with Thread.pass or anything which currently releases GVL (including IO#read, File.open, etc...). For platforms without GVL, it can be a no-op. I understand why this can be a bad feature from that perspective (I hate GVL, too). I mainly wanted this feature to give equivalance for proposed auto-Fiber [Feature #13618] behavior. Also, maybe disabling preempt less important since I am redoing [Misc #14937] to eliminate timer-thread completely for pthreads platforms; so there won't be a need to spawn extra threads even under contention. Unsubscribe: