File tree Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ module Concurrent
20
20
# @see http://ruby-doc.org/stdlib-2.2.0/libdoc/timeout/rdoc/Timeout.html Ruby Timeout::timeout
21
21
#
22
22
# @!macro monotonic_clock_warning
23
+ #
24
+ # @deprecated timeout is deprecated and will be removed
23
25
def timeout ( seconds , &block )
24
26
warn '[DEPRECATED] timeout is deprecated and will be removed'
25
27
Original file line number Diff line number Diff line change 1
1
require 'concurrent/configuration'
2
- require 'thread'
3
2
4
3
module Concurrent
5
4
6
- # Perform the given operation asynchronously after the given number of seconds.
7
- #
8
- # This is a convenience method for posting tasks to the global timer set.
9
- # It is intended to be simple and easy to use. For greater control use
10
- # either `TimerSet` or `ScheduledTask` directly.
5
+ # [DEPRECATED] Perform the given operation asynchronously after
6
+ # the given number of seconds.
11
7
#
12
8
# @param [Fixnum] seconds the interval in seconds to wait before executing the task
13
9
#
@@ -16,10 +12,10 @@ module Concurrent
16
12
# @return [Concurrent::ScheduledTask] IVar representing the task
17
13
#
18
14
# @see Concurrent::ScheduledTask
19
- # @see Concurrent::TimerSet
20
15
#
21
- # @!macro monotonic_clock_warning
16
+ # @deprecated use `ScheduledTask` instead
22
17
def timer ( seconds , *args , &block )
18
+ warn '[DEPRECATED] use ScheduledTask instead'
23
19
raise ArgumentError . new ( 'no block given' ) unless block_given?
24
20
raise ArgumentError . new ( 'interval must be greater than or equal to zero' ) if seconds < 0
25
21
Concurrent . configuration . global_timer_set . post ( seconds , *args , &block )
Original file line number Diff line number Diff line change 1
1
module Concurrent
2
2
3
- describe '#timeout' do
3
+ describe '#timeout' , notravis : true do
4
4
5
5
it 'raises an exception if no block is given' do
6
6
expect { Concurrent ::timeout ( 0.1 ) } . to raise_error
Original file line number Diff line number Diff line change 1
1
module Concurrent
2
2
3
- describe '#timer' do
3
+ describe '#timer' , notravis : true do
4
4
5
5
it 'raises an exception when no block given' do
6
6
expect {
You can’t perform that action at this time.
0 commit comments