concurrent-ruby 0.9.2 → 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -1
  3. data/README.md +67 -68
  4. data/lib/concurrent.rb +14 -1
  5. data/lib/concurrent/array.rb +38 -0
  6. data/lib/concurrent/async.rb +0 -17
  7. data/lib/concurrent/atomic/abstract_thread_local_var.rb +40 -0
  8. data/lib/concurrent/atomic/atomic_boolean.rb +81 -118
  9. data/lib/concurrent/atomic/atomic_fixnum.rb +98 -162
  10. data/lib/concurrent/atomic/atomic_reference.rb +0 -7
  11. data/lib/concurrent/atomic/count_down_latch.rb +62 -103
  12. data/lib/concurrent/atomic/cyclic_barrier.rb +2 -0
  13. data/lib/concurrent/atomic/java_count_down_latch.rb +39 -0
  14. data/lib/concurrent/atomic/java_thread_local_var.rb +50 -0
  15. data/lib/concurrent/atomic/mutex_atomic_boolean.rb +60 -0
  16. data/lib/concurrent/atomic/mutex_atomic_fixnum.rb +91 -0
  17. data/lib/concurrent/atomic/mutex_count_down_latch.rb +43 -0
  18. data/lib/concurrent/atomic/mutex_semaphore.rb +115 -0
  19. data/lib/concurrent/atomic/ruby_thread_local_var.rb +172 -0
  20. data/lib/concurrent/atomic/semaphore.rb +84 -178
  21. data/lib/concurrent/atomic/thread_local_var.rb +63 -294
  22. data/lib/concurrent/atomic_reference/mutex_atomic.rb +14 -8
  23. data/lib/concurrent/atomics.rb +0 -33
  24. data/lib/concurrent/collection/java_non_concurrent_priority_queue.rb +84 -0
  25. data/lib/concurrent/collection/map/atomic_reference_map_backend.rb +921 -0
  26. data/lib/concurrent/collection/map/mri_map_backend.rb +66 -0
  27. data/lib/concurrent/collection/map/non_concurrent_map_backend.rb +142 -0
  28. data/lib/concurrent/collection/map/synchronized_map_backend.rb +86 -0
  29. data/lib/concurrent/collection/non_concurrent_priority_queue.rb +143 -0
  30. data/lib/concurrent/collection/ruby_non_concurrent_priority_queue.rb +150 -0
  31. data/lib/concurrent/concern/logging.rb +1 -1
  32. data/lib/concurrent/concern/obligation.rb +0 -12
  33. data/lib/concurrent/configuration.rb +18 -148
  34. data/lib/concurrent/delay.rb +5 -4
  35. data/lib/concurrent/exchanger.rb +327 -41
  36. data/lib/concurrent/executor/abstract_executor_service.rb +134 -0
  37. data/lib/concurrent/executor/executor.rb +4 -29
  38. data/lib/concurrent/executor/executor_service.rb +23 -359
  39. data/lib/concurrent/executor/immediate_executor.rb +3 -2
  40. data/lib/concurrent/executor/java_executor_service.rb +100 -0
  41. data/lib/concurrent/executor/java_single_thread_executor.rb +3 -2
  42. data/lib/concurrent/executor/java_thread_pool_executor.rb +3 -4
  43. data/lib/concurrent/executor/ruby_executor_service.rb +72 -0
  44. data/lib/concurrent/executor/ruby_single_thread_executor.rb +7 -5
  45. data/lib/concurrent/executor/ruby_thread_pool_executor.rb +3 -11
  46. data/lib/concurrent/executor/safe_task_executor.rb +1 -1
  47. data/lib/concurrent/executor/serial_executor_service.rb +34 -0
  48. data/lib/concurrent/executor/serialized_execution.rb +8 -31
  49. data/lib/concurrent/executor/serialized_execution_delegator.rb +28 -0
  50. data/lib/concurrent/executor/simple_executor_service.rb +1 -10
  51. data/lib/concurrent/executor/timer_set.rb +4 -8
  52. data/lib/concurrent/executors.rb +13 -2
  53. data/lib/concurrent/future.rb +2 -2
  54. data/lib/concurrent/hash.rb +35 -0
  55. data/lib/concurrent/ivar.rb +9 -14
  56. data/lib/concurrent/map.rb +178 -0
  57. data/lib/concurrent/promise.rb +2 -2
  58. data/lib/concurrent/scheduled_task.rb +9 -69
  59. data/lib/concurrent/thread_safe/synchronized_delegator.rb +50 -0
  60. data/lib/concurrent/thread_safe/util.rb +23 -0
  61. data/lib/concurrent/thread_safe/util/adder.rb +71 -0
  62. data/lib/concurrent/thread_safe/util/array_hash_rbx.rb +28 -0
  63. data/lib/concurrent/thread_safe/util/cheap_lockable.rb +115 -0
  64. data/lib/concurrent/thread_safe/util/power_of_two_tuple.rb +37 -0
  65. data/lib/concurrent/thread_safe/util/striped64.rb +236 -0
  66. data/lib/concurrent/thread_safe/util/volatile.rb +73 -0
  67. data/lib/concurrent/thread_safe/util/xor_shift_random.rb +48 -0
  68. data/lib/concurrent/timer_task.rb +3 -3
  69. data/lib/concurrent/tuple.rb +86 -0
  70. data/lib/concurrent/version.rb +2 -2
  71. metadata +37 -10
  72. data/lib/concurrent/atomic/condition.rb +0 -78
  73. data/lib/concurrent/collection/priority_queue.rb +0 -360
  74. data/lib/concurrent/utilities.rb +0 -5
  75. data/lib/concurrent/utility/timeout.rb +0 -39
  76. data/lib/concurrent/utility/timer.rb +0 -26
  77. data/lib/concurrent_ruby.rb +0 -2
@@ -0,0 +1,73 @@
1
+ module Concurrent
2
+
3
+ # @!visibility private
4
+ module ThreadSafe
5
+
6
+ # @!visibility private
7
+ module Util
8
+
9
+ # @!visibility private
10
+ module Volatile
11
+
12
+ # Provides +volatile+ (in the JVM's sense) attribute accessors implemented
13
+ # atop of +Concurrent::AtomicReference+.
14
+ #
15
+ # Usage:
16
+ # class Foo
17
+ # extend Concurrent::ThreadSafe::Util::Volatile
18
+ # attr_volatile :foo, :bar
19
+ #
20
+ # def initialize(bar)
21
+ # super() # must super() into parent initializers before using the volatile attribute accessors
22
+ # self.bar = bar
23
+ # end
24
+ #
25
+ # def hello
26
+ # my_foo = foo # volatile read
27
+ # self.foo = 1 # volatile write
28
+ # cas_foo(1, 2) # => true | a strong CAS
29
+ # end
30
+ # end
31
+ def attr_volatile(*attr_names)
32
+ return if attr_names.empty?
33
+ include(Module.new do
34
+ atomic_ref_setup = attr_names.map {|attr_name| "@__#{attr_name} = Concurrent::AtomicReference.new"}
35
+ initialize_copy_setup = attr_names.zip(atomic_ref_setup).map do |attr_name, ref_setup|
36
+ "#{ref_setup}(other.instance_variable_get(:@__#{attr_name}).get)"
37
+ end
38
+ class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
39
+ def initialize(*)
40
+ super
41
+ #{atomic_ref_setup.join('; ')}
42
+ end
43
+
44
+ def initialize_copy(other)
45
+ super
46
+ #{initialize_copy_setup.join('; ')}
47
+ end
48
+ RUBY_EVAL
49
+
50
+ attr_names.each do |attr_name|
51
+ class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
52
+ def #{attr_name}
53
+ @__#{attr_name}.get
54
+ end
55
+
56
+ def #{attr_name}=(value)
57
+ @__#{attr_name}.set(value)
58
+ end
59
+
60
+ def compare_and_set_#{attr_name}(old_value, new_value)
61
+ @__#{attr_name}.compare_and_set(old_value, new_value)
62
+ end
63
+ RUBY_EVAL
64
+
65
+ alias_method :"cas_#{attr_name}", :"compare_and_set_#{attr_name}"
66
+ alias_method :"lazy_set_#{attr_name}", :"#{attr_name}="
67
+ end
68
+ end)
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,48 @@
1
+ module Concurrent
2
+
3
+ # @!visibility private
4
+ module ThreadSafe
5
+
6
+ # @!visibility private
7
+ module Util
8
+
9
+ # A xorshift random number (positive +Fixnum+s) generator, provides
10
+ # reasonably cheap way to generate thread local random numbers without
11
+ # contending for the global +Kernel.rand+.
12
+ #
13
+ # Usage:
14
+ # x = XorShiftRandom.get # uses Kernel.rand to generate an initial seed
15
+ # while true
16
+ # if (x = XorShiftRandom.xorshift).odd? # thread-localy generate a next random number
17
+ # do_something_at_random
18
+ # end
19
+ # end
20
+ module XorShiftRandom
21
+ extend self
22
+ MAX_XOR_SHIFTABLE_INT = MAX_INT - 1
23
+
24
+ # Generates an initial non-zero positive +Fixnum+ via +Kernel.rand+.
25
+ def get
26
+ Kernel.rand(MAX_XOR_SHIFTABLE_INT) + 1 # 0 can't be xorshifted
27
+ end
28
+
29
+ # xorshift based on: http://www.jstatsoft.org/v08/i14/paper
30
+ if 0.size == 4
31
+ # using the "yˆ=y>>a; yˆ=y<<b; yˆ=y>>c;" transform with the (a,b,c) tuple with values (3,1,14) to minimise Bignum overflows
32
+ def xorshift(x)
33
+ x ^= x >> 3
34
+ x ^= (x << 1) & MAX_INT # cut-off Bignum overflow
35
+ x ^= x >> 14
36
+ end
37
+ else
38
+ # using the "yˆ=y>>a; yˆ=y<<b; yˆ=y>>c;" transform with the (a,b,c) tuple with values (1,1,54) to minimise Bignum overflows
39
+ def xorshift(x)
40
+ x ^= x >> 1
41
+ x ^= (x << 1) & MAX_INT # cut-off Bignum overflow
42
+ x ^= x >> 54
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -268,7 +268,7 @@ module Concurrent
268
268
 
269
269
  private :post, :<<
270
270
 
271
- protected
271
+ private
272
272
 
273
273
  def ns_initialize(opts, &task)
274
274
  init_mutex(self)
@@ -284,13 +284,13 @@ module Concurrent
284
284
  end
285
285
 
286
286
  # @!visibility private
287
- def shutdown_execution
287
+ def ns_shutdown_execution
288
288
  @running.make_false
289
289
  super
290
290
  end
291
291
 
292
292
  # @!visibility private
293
- def kill_execution
293
+ def ns_kill_execution
294
294
  @running.make_false
295
295
  super
296
296
  end
@@ -0,0 +1,86 @@
1
+ require 'concurrent/atomic/atomic_reference'
2
+
3
+ module Concurrent
4
+
5
+ # A fixed size array with volatile (synchronized, thread safe) getters/setters.
6
+ # Mixes in Ruby's `Enumerable` module for enhanced search, sort, and traversal.
7
+ #
8
+ # @example
9
+ # tuple = Concurrent::Tuple.new(16)
10
+ #
11
+ # tuple.set(0, :foo) #=> :foo | volatile write
12
+ # tuple.get(0) #=> :foo | volatile read
13
+ # tuple.compare_and_set(0, :foo, :bar) #=> true | strong CAS
14
+ # tuple.cas(0, :foo, :baz) #=> false | strong CAS
15
+ # tuple.get(0) #=> :bar | volatile read
16
+ #
17
+ # @see https://en.wikipedia.org/wiki/Tuple Tuple entry at Wikipedia
18
+ # @see http://www.erlang.org/doc/reference_manual/data_types.html#id70396 Erlang Tuple
19
+ # @see http://ruby-doc.org/core-2.2.2/Enumerable.html Enumerable
20
+ class Tuple
21
+ include Enumerable
22
+
23
+ # The (fixed) size of the tuple.
24
+ attr_reader :size
25
+
26
+ # @!visibility private
27
+ Tuple = defined?(Rubinius::Tuple) ? Rubinius::Tuple : Array
28
+ private_constant :Tuple
29
+
30
+ # Create a new tuple of the given size.
31
+ #
32
+ # @param [Integer] size the number of elements in the tuple
33
+ def initialize(size)
34
+ @size = size
35
+ @tuple = tuple = Tuple.new(size)
36
+ i = 0
37
+ while i < size
38
+ tuple[i] = Concurrent::AtomicReference.new
39
+ i += 1
40
+ end
41
+ end
42
+
43
+ # Get the value of the element at the given index.
44
+ #
45
+ # @param [Integer] i the index from which to retrieve the value
46
+ # @return [Object] the value at the given index or nil if the index is out of bounds
47
+ def get(i)
48
+ return nil if i >= @size || i < 0
49
+ @tuple[i].get
50
+ end
51
+ alias_method :volatile_get, :get
52
+
53
+ # Set the element at the given index to the given value
54
+ #
55
+ # @param [Integer] i the index for the element to set
56
+ # @param [Object] value the value to set at the given index
57
+ #
58
+ # @return [Object] the new value of the element at the given index or nil if the index is out of bounds
59
+ def set(i, value)
60
+ return nil if i >= @size || i < 0
61
+ @tuple[i].set(value)
62
+ end
63
+ alias_method :volatile_set, :set
64
+
65
+ # Set the value at the given index to the new value if and only if the current
66
+ # value matches the given old value.
67
+ #
68
+ # @param [Integer] i the index for the element to set
69
+ # @param [Object] old_value the value to compare against the current value
70
+ # @param [Object] new_value the value to set at the given index
71
+ #
72
+ # @return [Boolean] true if the value at the given element was set else false
73
+ def compare_and_set(i, old_value, new_value)
74
+ return false if i >= @size || i < 0
75
+ @tuple[i].compare_and_set(old_value, new_value)
76
+ end
77
+ alias_method :cas, :compare_and_set
78
+
79
+ # Calls the given block once for each element in self, passing that element as a parameter.
80
+ #
81
+ # @yieldparam [Object] ref the `Concurrent::AtomicReference` object at the current index
82
+ def each
83
+ @tuple.each {|ref| yield ref.get}
84
+ end
85
+ end
86
+ end
@@ -1,4 +1,4 @@
1
1
  module Concurrent
2
- VERSION = '0.9.2'
3
- EDGE_VERSION = '0.1.2'
2
+ VERSION = '1.0.0.pre1'
3
+ EDGE_VERSION = '0.2.0.pre1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 1.0.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry D'Antonio
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-04 00:00:00.000000000 Z
12
+ date: 2015-08-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: |
15
15
  Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
@@ -28,17 +28,25 @@ files:
28
28
  - LICENSE.txt
29
29
  - README.md
30
30
  - lib/concurrent.rb
31
+ - lib/concurrent/array.rb
31
32
  - lib/concurrent/async.rb
32
33
  - lib/concurrent/atom.rb
34
+ - lib/concurrent/atomic/abstract_thread_local_var.rb
33
35
  - lib/concurrent/atomic/atomic_boolean.rb
34
36
  - lib/concurrent/atomic/atomic_fixnum.rb
35
37
  - lib/concurrent/atomic/atomic_reference.rb
36
- - lib/concurrent/atomic/condition.rb
37
38
  - lib/concurrent/atomic/count_down_latch.rb
38
39
  - lib/concurrent/atomic/cyclic_barrier.rb
39
40
  - lib/concurrent/atomic/event.rb
41
+ - lib/concurrent/atomic/java_count_down_latch.rb
42
+ - lib/concurrent/atomic/java_thread_local_var.rb
43
+ - lib/concurrent/atomic/mutex_atomic_boolean.rb
44
+ - lib/concurrent/atomic/mutex_atomic_fixnum.rb
45
+ - lib/concurrent/atomic/mutex_count_down_latch.rb
46
+ - lib/concurrent/atomic/mutex_semaphore.rb
40
47
  - lib/concurrent/atomic/read_write_lock.rb
41
48
  - lib/concurrent/atomic/reentrant_read_write_lock.rb
49
+ - lib/concurrent/atomic/ruby_thread_local_var.rb
42
50
  - lib/concurrent/atomic/semaphore.rb
43
51
  - lib/concurrent/atomic/thread_local_var.rb
44
52
  - lib/concurrent/atomic_reference/concurrent_update_error.rb
@@ -51,7 +59,13 @@ files:
51
59
  - lib/concurrent/atomics.rb
52
60
  - lib/concurrent/collection/copy_on_notify_observer_set.rb
53
61
  - lib/concurrent/collection/copy_on_write_observer_set.rb
54
- - lib/concurrent/collection/priority_queue.rb
62
+ - lib/concurrent/collection/java_non_concurrent_priority_queue.rb
63
+ - lib/concurrent/collection/map/atomic_reference_map_backend.rb
64
+ - lib/concurrent/collection/map/mri_map_backend.rb
65
+ - lib/concurrent/collection/map/non_concurrent_map_backend.rb
66
+ - lib/concurrent/collection/map/synchronized_map_backend.rb
67
+ - lib/concurrent/collection/non_concurrent_priority_queue.rb
68
+ - lib/concurrent/collection/ruby_non_concurrent_priority_queue.rb
55
69
  - lib/concurrent/concern/deprecation.rb
56
70
  - lib/concurrent/concern/dereferenceable.rb
57
71
  - lib/concurrent/concern/logging.rb
@@ -63,27 +77,34 @@ files:
63
77
  - lib/concurrent/edge.rb
64
78
  - lib/concurrent/errors.rb
65
79
  - lib/concurrent/exchanger.rb
80
+ - lib/concurrent/executor/abstract_executor_service.rb
66
81
  - lib/concurrent/executor/cached_thread_pool.rb
67
82
  - lib/concurrent/executor/executor.rb
68
83
  - lib/concurrent/executor/executor_service.rb
69
84
  - lib/concurrent/executor/fixed_thread_pool.rb
70
85
  - lib/concurrent/executor/immediate_executor.rb
71
86
  - lib/concurrent/executor/indirect_immediate_executor.rb
87
+ - lib/concurrent/executor/java_executor_service.rb
72
88
  - lib/concurrent/executor/java_single_thread_executor.rb
73
89
  - lib/concurrent/executor/java_thread_pool_executor.rb
90
+ - lib/concurrent/executor/ruby_executor_service.rb
74
91
  - lib/concurrent/executor/ruby_single_thread_executor.rb
75
92
  - lib/concurrent/executor/ruby_thread_pool_executor.rb
76
93
  - lib/concurrent/executor/safe_task_executor.rb
94
+ - lib/concurrent/executor/serial_executor_service.rb
77
95
  - lib/concurrent/executor/serialized_execution.rb
96
+ - lib/concurrent/executor/serialized_execution_delegator.rb
78
97
  - lib/concurrent/executor/simple_executor_service.rb
79
98
  - lib/concurrent/executor/single_thread_executor.rb
80
99
  - lib/concurrent/executor/thread_pool_executor.rb
81
100
  - lib/concurrent/executor/timer_set.rb
82
101
  - lib/concurrent/executors.rb
83
102
  - lib/concurrent/future.rb
103
+ - lib/concurrent/hash.rb
84
104
  - lib/concurrent/immutable_struct.rb
85
105
  - lib/concurrent/ivar.rb
86
106
  - lib/concurrent/lazy_register.rb
107
+ - lib/concurrent/map.rb
87
108
  - lib/concurrent/maybe.rb
88
109
  - lib/concurrent/mutable_struct.rb
89
110
  - lib/concurrent/mvar.rb
@@ -100,18 +121,24 @@ files:
100
121
  - lib/concurrent/synchronization/mutex_object.rb
101
122
  - lib/concurrent/synchronization/object.rb
102
123
  - lib/concurrent/synchronization/rbx_object.rb
124
+ - lib/concurrent/thread_safe/synchronized_delegator.rb
125
+ - lib/concurrent/thread_safe/util.rb
126
+ - lib/concurrent/thread_safe/util/adder.rb
127
+ - lib/concurrent/thread_safe/util/array_hash_rbx.rb
128
+ - lib/concurrent/thread_safe/util/cheap_lockable.rb
129
+ - lib/concurrent/thread_safe/util/power_of_two_tuple.rb
130
+ - lib/concurrent/thread_safe/util/striped64.rb
131
+ - lib/concurrent/thread_safe/util/volatile.rb
132
+ - lib/concurrent/thread_safe/util/xor_shift_random.rb
103
133
  - lib/concurrent/timer_task.rb
134
+ - lib/concurrent/tuple.rb
104
135
  - lib/concurrent/tvar.rb
105
- - lib/concurrent/utilities.rb
106
136
  - lib/concurrent/utility/at_exit.rb
107
137
  - lib/concurrent/utility/engine.rb
108
138
  - lib/concurrent/utility/monotonic_time.rb
109
139
  - lib/concurrent/utility/native_extension_loader.rb
110
140
  - lib/concurrent/utility/processor_counter.rb
111
- - lib/concurrent/utility/timeout.rb
112
- - lib/concurrent/utility/timer.rb
113
141
  - lib/concurrent/version.rb
114
- - lib/concurrent_ruby.rb
115
142
  homepage: http://www.concurrent-ruby.com
116
143
  licenses:
117
144
  - MIT
@@ -127,9 +154,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
154
  version: 1.9.3
128
155
  required_rubygems_version: !ruby/object:Gem::Requirement
129
156
  requirements:
130
- - - ">="
157
+ - - ">"
131
158
  - !ruby/object:Gem::Version
132
- version: '0'
159
+ version: 1.3.1
133
160
  requirements: []
134
161
  rubyforge_project:
135
162
  rubygems_version: 2.4.8
@@ -1,78 +0,0 @@
1
- require 'concurrent/utility/monotonic_time'
2
- require 'concurrent/concern/deprecation'
3
-
4
- module Concurrent
5
-
6
- # Condition is a better implementation of standard Ruby ConditionVariable. The
7
- # biggest difference is the wait return value: Condition#wait returns
8
- # Condition::Result which make possible to know if waiting thread has been
9
- # woken up by an another thread (using #signal or #broadcast) or due to
10
- # timeout.
11
- #
12
- # Every #wait must be guarded by a locked Mutex or a ThreadError will be
13
- # risen. Although it's not mandatory, it's recommended to call also #signal
14
- # and #broadcast within the same mutex
15
- #
16
- # @deprecated
17
- class Condition
18
- include Concern::Deprecation
19
-
20
- class Result
21
- def initialize(remaining_time)
22
- @remaining_time = remaining_time
23
- end
24
-
25
- attr_reader :remaining_time
26
-
27
- # @return [Boolean] true if current thread has been waken up by a #signal
28
- # or a #broadcast call , otherwise false
29
- def woken_up?
30
- @remaining_time.nil? || @remaining_time > 0
31
- end
32
-
33
- # @return [Boolean] true if current thread has been waken up due to a
34
- # timeout, otherwise false
35
- def timed_out?
36
- @remaining_time != nil && @remaining_time <= 0
37
- end
38
-
39
- alias_method :can_wait?, :woken_up?
40
-
41
- end
42
-
43
- def initialize
44
- deprecated 'Will be replaced with Synchronization::Object in v1.0.'
45
- @condition = ConditionVariable.new
46
- end
47
-
48
- # @param [Mutex] mutex the locked mutex guarding the wait
49
- # @param [Object] timeout nil means no timeout
50
- # @return [Result]
51
- #
52
- # @!macro monotonic_clock_warning
53
- def wait(mutex, timeout = nil)
54
- start_time = Concurrent.monotonic_time
55
- @condition.wait(mutex, timeout)
56
-
57
- if timeout.nil?
58
- Result.new(nil)
59
- else
60
- Result.new(start_time + timeout - Concurrent.monotonic_time)
61
- end
62
- end
63
-
64
- # Wakes up a waiting thread
65
- # @return [true]
66
- def signal
67
- @condition.signal
68
- true
69
- end
70
-
71
- # Wakes up all waiting threads
72
- # @return [true]
73
- def broadcast
74
- @condition.broadcast
75
- true
76
- end
77
- end
78
- end