The Timeout::Error example no longer works consistently

* This PR from the timeout gem (https://github.com/ruby/timeout/pull/30) made it so you have to handle_interrupt on Timeout::ExitException instead of Timeout::Error

* Efficiency changes to the gem (one shared thread) mean you can't consistently handle timeout errors using handle_timeout: https://github.com/ruby/timeout/issues/41
This commit is contained in:
JP Camara 2024-08-27 21:57:49 +00:00 коммит произвёл Hiroshi SHIBATA
Родитель 19c1f0233e
Коммит b5f1291015
1 изменённых файлов: 0 добавлений и 24 удалений

Просмотреть файл

@ -2215,30 +2215,6 @@ handle_interrupt_arg_check_i(VALUE key, VALUE val, VALUE args)
* resource allocation code. Then, the ensure block is where we can safely
* deallocate your resources.
*
* ==== Guarding from Timeout::Error
*
* In the next example, we will guard from the Timeout::Error exception. This
* will help prevent from leaking resources when Timeout::Error exceptions occur
* during normal ensure clause. For this example we use the help of the
* standard library Timeout, from lib/timeout.rb
*
* require 'timeout'
* Thread.handle_interrupt(Timeout::Error => :never) {
* timeout(10){
* # Timeout::Error doesn't occur here
* Thread.handle_interrupt(Timeout::Error => :on_blocking) {
* # possible to be killed by Timeout::Error
* # while blocking operation
* }
* # Timeout::Error doesn't occur here
* }
* }
*
* In the first part of the +timeout+ block, we can rely on Timeout::Error being
* ignored. Then in the <code>Timeout::Error => :on_blocking</code> block, any
* operation that will block the calling thread is susceptible to a
* Timeout::Error exception being raised.
*
* ==== Stack control settings
*
* It's possible to stack multiple levels of ::handle_interrupt blocks in order