Граф коммитов

82 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA 3909cfaa02 [ruby/timeout] Bump version to 0.3.1
https://github.com/ruby/timeout/commit/4941e8c871
2022-12-05 08:13:18 +00:00
Lars Kanis 9d56d9975d [ruby/timeout] Explicit add the timeout thread to default ThreadGroup
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
2022-09-28 01:59:35 +09:00
Jean Boussier 8290d76647 [ruby/timeout] Give a name to the background thread
https://github.com/ruby/timeout/commit/5594ae2f4d
2022-07-13 21:16:15 +09:00
Jean Boussier 4e21b19a61 [ruby/timeout] Keep a private reference to `Process.clock_gettime`
`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
2022-06-09 18:58:49 +09:00
Nobuyoshi Nakada cd6f87eefc [ruby/timeout] Set the flag surely before return
https://github.com/ruby/timeout/commit/f3a31abdfb
2022-05-25 19:50:47 +09:00
Nobuyoshi Nakada e77e233935 [ruby/timeout] Hack to avoid leak checker
https://github.com/ruby/timeout/commit/9a9b03b44c
2022-05-25 18:47:26 +09:00
Hiroshi SHIBATA fde4519af8 [ruby/timeout] Bump version to 0.3.0
https://github.com/ruby/timeout/commit/f69f954a94
2022-05-25 18:08:01 +09:00
Benoit Daloze 75fcfb1416 [ruby/timeout] Remove redundant done? check
* It's already checked inside #interrupt.

https://github.com/ruby/timeout/commit/5f43254f81
2022-05-19 07:19:42 +09:00
Benoit Daloze 240ac9eaa8 [ruby/timeout] Synchronize all accesses to @done
* So it is trivially correct.
* Performance seems the same overall.

https://github.com/ruby/timeout/commit/5e0d8e1637
2022-05-19 07:19:41 +09:00
Benoit Daloze 354cd6f210 [ruby/timeout] Handle Timeout + fork and add test for it
https://github.com/ruby/timeout/commit/4baee63b9b
2022-05-19 07:19:40 +09:00
Benoit Daloze 89fbec224d [ruby/timeout] Reimplement Timeout.timeout with a single thread and a Queue
https://github.com/ruby/timeout/commit/2bafc458f1
2022-05-19 07:19:39 +09:00
Hiroshi SHIBATA 2c75fc915e [ruby/timeout] Bump up timeout version to 0.2.0
https://github.com/ruby/timeout/commit/02e792ddd8
2021-10-14 20:12:29 +09:00
rm155 0a38212e57 [ruby/timeout] Freeze VERSION
https://github.com/ruby/timeout/commit/ac7b010c41
2021-09-27 19:36:20 +09:00
Jeremy Evans 120b835fae [ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists
https://github.com/ruby/timeout/commit/4893cde0ed
2021-05-06 16:51:10 +09:00
Jeremy Evans 44e8575ca6 [ruby/timeout] Avoid unnecessary object allocation
Idea from nobu.

https://github.com/ruby/timeout/commit/aecdaa23b3
2021-05-06 16:50:31 +09:00
Jeremy Evans 33b5e179a8 [ruby/timeout] Make Timeout::Error#exception with multiple arguments not 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
2021-05-06 16:49:26 +09:00
Samuel Williams 92449e0e99 Fix handling of timeout accessing scheduler outside of non-blocking context. 2021-03-30 18:38:42 +13:00
Samuel Williams 511acba4ae Update method name and add documentation. 2021-03-30 18:38:42 +13:00
Samuel Williams 9b9bbaec11 Update lib/timeout.rb
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-03-30 18:38:42 +13:00
Samuel Williams 4c53dc970b Add hook for `Timeout.timeout`. 2021-03-30 18:38:42 +13:00
Nobuyoshi Nakada bc4c862a76 [ruby/timeout] Removed deprecated names that had been warned for 5 years
https://github.com/ruby/timeout/commit/f9a9758a41
2021-01-03 20:19:30 +09:00
Hiroshi SHIBATA 9b9cbbbc17
Update library versions of the default gems.
They are followed up with
  8fb02b7a97
2020-12-22 21:45:28 +09:00
Nobuyoshi Nakada b2d96abb42 Extract version number from the source
"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.
2020-07-30 19:03:18 +09:00
Jeremy Evans 96d6527424 Add some documentation to Timeout#timeout about possible issues
Documentation requested in [Bug #15886].
2019-06-04 19:19:37 -07:00
shyouhei f2a91397fd Add uplevel keyword to Kernel#warn and use it
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
2017-12-12 11:56:25 +00:00
kazu 859abb7ffb Fix typo in `Timeout` doc [ci skip]
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
2017-11-17 15:08:03 +00:00
kazu aaf249dc57 fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 12:32:02 +00:00
nobu 047ca4ba1a timeout.rb: custom error message
* 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
2016-09-07 08:21:56 +00:00
nobu d660e06f28 timeout.rb: watcher thread name
* 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
2015-12-18 15:46:50 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
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
2015-12-16 05:07:31 +00:00
nobu b0f2785d6c timeout.rb: freeze a string message
* 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
2015-08-13 13:49:44 +00:00
nobu 83cd51e3fe variable.c: Module#deprecate_constant
* 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
2015-07-30 04:20:00 +00:00
nobu cb04140542 timeout.rb: suppress a warning
* 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
2015-07-14 02:34:53 +00:00
nobu fa474e56cd timeout.rb: warn deprecated method
* 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
2015-07-13 10:11:38 +00:00
nobu 42f1ff1272 timeout.rb: internal constants
* 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
2015-07-13 04:50:20 +00:00
nobu a2b889f4ab timeout.rb: fix backtrace
* 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
2015-07-11 03:45:54 +00:00
nobu 0f663b2449 timeout.rb: removed and use Timeout::Error
* 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
2015-07-10 13:05:53 +00:00
nobu 1133596e6b timeout.rb: same object across fiber
* 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
2014-11-17 03:42:49 +00:00
nobu f45e0d537f timeout.rb: use UncaughtThrowError
* 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
2014-11-16 10:11:08 +00:00
nobu 3e9e4a6a96 lib/timeout.rb: fallback to Timeout::Error
* 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
2014-01-08 04:12:39 +00:00
nobu 1fa01c12df timeout.rb: revert r44520
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-07 12:21:51 +00:00
nobu 82b1790df0 timeout.rb: current_target
* 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
2014-01-07 12:08:45 +00:00
nobu ed9f79df1a timeout.rb: unused attribute
* 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
2014-01-07 03:43:44 +00:00
nobu 97c0aaea71 timeout.rb: fix for ExitException
* 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
2014-01-07 03:43:08 +00:00
nobu 9f5537c5b3 timeout.rb: defer creating custom exception
* 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
2014-01-07 03:42:37 +00:00
zzak 12e20b7c4d * lib/timeout.rb: Added note about change from #8730 [Fixes GH-440]
* 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
2013-11-10 16:05:04 +00:00
nobu ba57274860 timeout.rb: raise given exception
* 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
2013-08-27 08:18:50 +00:00
nobu 1a3bcf103c timeout.rb: skip rescue
* 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
2013-08-26 06:27:48 +00:00
hsbt e8e7e1aae2 doumentation by @toolmantim [GH fixes #270]
* timeout.rb: Document Timeout::timeout 0 and nil argument behavior



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-31 02:01:17 +00:00
kosaki 3bbffbc7dd Revert r38216 and r38221. Release manager mark this feature as "next minor".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07 10:36:59 +00:00