summaryrefslogtreecommitdiff
path: root/lib/timeout.rb
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/timeout] bump up 0.3.2Hiroshi SHIBATA2023-02-161-1/+1
| | | | https://github.com/ruby/timeout/commit/e1b2448101
* [ruby/timeout] Don't move the timer_thread when it's enclosedRick Blommers2023-02-151-1/+1
| | | | | | | | Don't move the timer_thread to ThreadGroup::Default, when it's created in an enclosed ThreadGroup. Prevents the exception: "add" can't move from the enclosed thread group" https://github.com/ruby/timeout/commit/eb889d2c8b
* [ruby/timeout] Bump version to 0.3.1Hiroshi SHIBATA2022-12-051-1/+1
| | | | https://github.com/ruby/timeout/commit/4941e8c871
* [ruby/timeout] Explicit add the timeout thread to default ThreadGroupLars Kanis2022-09-281-0/+1
| | | | | | | | | | Otherwise the timeout thread would be added to the ThreadGroup of the thread that makes the first call to Timeout.timeout . Fixes bug 19020: https://bugs.ruby-lang.org/issues/19020 Add a test case to make sure the common thread doesn't leak to another ThreadGroup https://github.com/ruby/timeout/commit/c4f1385c9a
* [ruby/timeout] Give a name to the background threadJean Boussier2022-07-131-0/+1
| | | | https://github.com/ruby/timeout/commit/5594ae2f4d
* [ruby/timeout] Keep a private reference to `Process.clock_gettime`Jean Boussier2022-06-091-2/+8
| | | | | | | | | | `timeout 0.3.0` broke our test suite because we have some tests that stubs `Process.clock_gettime` making it return a value in the past, causing `Timeout` to trigger almost immediately. I beleive it wasn't a problem before because it was relying on `Process.sleep`. https://github.com/ruby/timeout/commit/e5911a303e
* [ruby/timeout] Set the flag surely before returnNobuyoshi Nakada2022-05-251-2/+3
| | | | https://github.com/ruby/timeout/commit/f3a31abdfb
* [ruby/timeout] Hack to avoid leak checkerNobuyoshi Nakada2022-05-251-0/+1
| | | | https://github.com/ruby/timeout/commit/9a9b03b44c
* [ruby/timeout] Bump version to 0.3.0Hiroshi SHIBATA2022-05-251-1/+1
| | | | https://github.com/ruby/timeout/commit/f69f954a94
* [ruby/timeout] Remove redundant done? checkBenoit Daloze2022-05-191-1/+1
| | | | | | * It's already checked inside #interrupt. https://github.com/ruby/timeout/commit/5f43254f81
* [ruby/timeout] Synchronize all accesses to @doneBenoit Daloze2022-05-191-2/+4
| | | | | | | * So it is trivially correct. * Performance seems the same overall. https://github.com/ruby/timeout/commit/5e0d8e1637
* [ruby/timeout] Handle Timeout + fork and add test for itBenoit Daloze2022-05-191-22/+29
| | | | https://github.com/ruby/timeout/commit/4baee63b9b
* [ruby/timeout] Reimplement Timeout.timeout with a single thread and a QueueBenoit Daloze2022-05-191-37/+88
| | | | https://github.com/ruby/timeout/commit/2bafc458f1
* [ruby/timeout] Bump up timeout version to 0.2.0Hiroshi SHIBATA2021-10-141-1/+1
| | | | https://github.com/ruby/timeout/commit/02e792ddd8
* [ruby/timeout] Freeze VERSIONrm1552021-09-271-1/+1
| | | | https://github.com/ruby/timeout/commit/ac7b010c41
* [ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler ↵Jeremy Evans2021-05-061-1/+1
| | | | | | exists https://github.com/ruby/timeout/commit/4893cde0ed
* [ruby/timeout] Avoid unnecessary object allocationJeremy Evans2021-05-061-3/+2
| | | | | | Idea from nobu. https://github.com/ruby/timeout/commit/aecdaa23b3
* [ruby/timeout] Make Timeout::Error#exception with multiple arguments not ↵Jeremy Evans2021-05-061-3/+6
| | | | | | | | | | | | | | | | | ignore arguments This makes: raise(Timeout::Error.new("hello"), "world") raise a TimeoutError instance with "world" as the message instead of "hello", for consistency with other Ruby exception classes. This required some internal changes to keep the tests passing. Fixes [Bug #17812] https://github.com/ruby/timeout/commit/952154dbf9
* Fix handling of timeout accessing scheduler outside of non-blocking context.Samuel Williams2021-03-301-1/+1
|
* Update method name and add documentation.Samuel Williams2021-03-301-2/+5
|
* Update lib/timeout.rbSamuel Williams2021-03-301-1/+1
| | | Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Add hook for `Timeout.timeout`.Samuel Williams2021-03-301-1/+7
|
* [ruby/timeout] Removed deprecated names that had been warned for 5 yearsNobuyoshi Nakada2021-01-031-12/+0
| | | | https://github.com/ruby/timeout/commit/f9a9758a41
* Update library versions of the default gems.Hiroshi SHIBATA2020-12-221-1/+1
| | | | | They are followed up with https://github.com/ruby/ruby/commit/8fb02b7a97317090e3946e6f2d4a7d034f9699f1
* Extract version number from the sourceNobuyoshi Nakada2020-07-301-0/+2
| | | | | | | | | | | "requiring version.rb" strategy has some issues. - cannot work when cross-compiling - often introduces wrong namespace - must know the superclasses - costs at each runtime than at build-time etc.
* Add some documentation to Timeout#timeout about possible issuesJeremy Evans2019-06-041-1/+3
| | | | Documentation requested in [Bug #15886].
* Add uplevel keyword to Kernel#warn and use itshyouhei2017-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If uplevel keyword is given, the warning message is prepended with caller file and line information and the string "warning: ". The use of the uplevel keyword makes Kernel#warn format output similar to how rb_warn formats output. This patch modifies net/ftp and net/imap to use Kernel#warn instead of $stderr.puts or $stderr.printf, since they are used for printing warnings. This makes lib/cgi/core and tempfile use $stderr.puts instead of warn for debug logging, since they are used for debug printing and not for warning. This does not modify bundler, rubygems, or rdoc, as those are maintained outside of ruby and probably wish to remain backwards compatible with older ruby versions. rb_warn_m code is originally from nobu, but I've changed it so that it only includes the path and lineno from uplevel (not the method), and also prepends the string "warning: ", to make it more similar to rb_warn. From: Jeremy Evans code@jeremyevans.net Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix typo in `Timeout` doc [ci skip]kazu2017-11-171-2/+2
| | | | | | | | Author: yuuji.yaginuma <yuuji.yaginuma@gmail.com> https://github.com/ruby/ruby/pull/1760 [Fix GH-1760] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix a typo [ci skip]kazu2016-09-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: custom error messagenobu2016-09-071-2/+4
| | | | | | | * lib/timeout.rb (Timeout#timeout): add custom error message argument. [Feature #11650] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: watcher thread namenobu2015-12-181-0/+2
| | | | | | | * lib/timeout.rb (Timeout#timeout): set watcher thread name to caller location for debugging. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: freeze a string messagenobu2015-08-131-1/+1
| | | | | | | * lib/timeout.rb (Timeout#timeout): freeze a string message to reduce string allocations. [Fix GH-996] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: Module#deprecate_constantnobu2015-07-301-0/+3
| | | | | | | | * variable.c (rb_const_get_0): warn deprecated constant reference. * variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: suppress a warningnobu2015-07-141-1/+1
| | | | | | * lib/timeout.rb (Timeout): get rid of an argument prefix warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: warn deprecated methodnobu2015-07-131-8/+3
| | | | | | * lib/timeout.rb (timeout): warn as deprecated for a long time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: internal constantsnobu2015-07-131-0/+1
| | | | | | * lib/timeout.rb (Timeout): make internal constants private. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: fix backtracenobu2015-07-111-3/+1
| | | | | | | * lib/timeout.rb (Timeout#timeout): remove regexp with wrong line nuber and fix caller depth. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: removed and use Timeout::Errornobu2015-07-101-3/+1
| | | | | | | | * lib/timeout.rb (ExitException): removed internal exception class and use Timeout::Error instead, as using throw/catch to isolate each timeouts now. [ruby-dev:49179] [Bug #11344] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: same object across fibernobu2014-11-171-2/+1
| | | | | | | | * lib/timeout.rb (Timeout::ExitException.catch): do not freeze the exception for tag, so that the same object can be passed to the target fiber without duplication to attach backtrace at raise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: use UncaughtThrowErrornobu2014-11-161-2/+1
| | | | | | | | * lib/timeout.rb (Timeout::ExitException#exception): rescue UncaughtThrowError which is specific for throw, instead of ArgumentError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/timeout.rb: fallback to Timeout::Errornobu2014-01-081-4/+12
| | | | | | | | | | | * lib/timeout.rb (Timeout::ExitException.catch): pass arguments for new instance. * lib/timeout.rb (Timeout::ExitException#exception): fallback to Timeout::Error if couldn't throw. [ruby-dev:47872] [Bug #9380] * lib/timeout.rb (Timeout#timeout): initialize ExitException with message for the fallback case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: revert r44520nobu2014-01-071-7/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: current_targetnobu2014-01-071-3/+7
| | | | | | | | | * lib/timeout.rb (Timeout::ExitException#target): rename attribute. * lib/timeout.rb (Timeout::ExitException.current_target): extract a method to achieve the target. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: unused attributenobu2014-01-071-1/+1
| | | | | | | * lib/timeout.rb (Timeout::ExitException): remove unused attribute, klass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: fix for ExitExceptionnobu2014-01-071-7/+14
| | | | | | | | | * lib/timeout.rb (Timeout#timeout): should not rescue ordinarily raised ExitException, which should not be thrown. * lib/timeout.rb (Timeout::ExitException.catch): set @thread only if it ought to be caught. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: defer creating custom exceptionnobu2014-01-071-2/+3
| | | | | | | | * lib/timeout.rb (Timeout#timeout): when a custom exception is given, no instance is needed to be caught, so defer creating new instance until it is raised. [ruby-core:59511] [Bug #9354] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/timeout.rb: Added note about change from #8730 [Fixes GH-440]zzak2013-11-101-0/+3
| | | | | | | | * NEWS: Improve grammar on change to Timeout Patched by @srawlins in https://github.com/ruby/ruby/pull/440 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: raise given exceptionnobu2013-08-271-4/+7
| | | | | | | * lib/timeout.rb (Timeout#timeout): skip rescue clause only when no exception class is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* timeout.rb: skip rescuenobu2013-08-261-14/+22
| | | | | | | * lib/timeout.rb (Timeout#timeout): should not be caught by rescue clause. [Bug #8730] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e