diff options
| author | JP Camara <jp@jpcamara.com> | 2024-08-27 21:57:49 +0000 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-09-09 09:10:06 +0900 |
| commit | b5f12910151f93f5f14057c52ffffa2b2ef09caa (patch) | |
| tree | 9000d3017ff6286930eab91c29a5e32519f27d7a /thread.c | |
| parent | 19c1f0233eb5202403c52b196f1d573893eacab7 (diff) | |
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
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11474
Diffstat (limited to 'thread.c')
| -rw-r--r-- | thread.c | 24 |
1 files changed, 0 insertions, 24 deletions
@@ -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 |
