concurrent-ruby 0.7.0-x64-mingw32 → 0.7.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +138 -0
  3. data/README.md +73 -105
  4. data/lib/2.0/concurrent_ruby_ext.so +0 -0
  5. data/lib/concurrent/actor.rb +11 -12
  6. data/lib/concurrent/actor/behaviour/errors_on_unknown_message.rb +1 -1
  7. data/lib/concurrent/actor/behaviour/linking.rb +4 -1
  8. data/lib/concurrent/actor/behaviour/pausing.rb +2 -2
  9. data/lib/concurrent/actor/behaviour/supervised.rb +2 -1
  10. data/lib/concurrent/actor/behaviour/termination.rb +1 -1
  11. data/lib/concurrent/actor/context.rb +2 -1
  12. data/lib/concurrent/actor/core.rb +7 -3
  13. data/lib/concurrent/actor/utils/balancer.rb +4 -2
  14. data/lib/concurrent/actor/utils/pool.rb +1 -1
  15. data/lib/concurrent/agent.rb +1 -22
  16. data/lib/concurrent/async.rb +1 -79
  17. data/lib/concurrent/atomic.rb +1 -1
  18. data/lib/concurrent/atomic/thread_local_var.rb +71 -24
  19. data/lib/concurrent/atomics.rb +0 -1
  20. data/lib/concurrent/configuration.rb +11 -5
  21. data/lib/concurrent/dataflow.rb +1 -30
  22. data/lib/concurrent/dereferenceable.rb +9 -2
  23. data/lib/concurrent/executor/indirect_immediate_executor.rb +46 -0
  24. data/lib/concurrent/executor/java_thread_pool_executor.rb +2 -4
  25. data/lib/concurrent/executor/ruby_thread_pool_executor.rb +24 -22
  26. data/lib/concurrent/executor/thread_pool_executor.rb +2 -0
  27. data/lib/concurrent/executor/timer_set.rb +7 -8
  28. data/lib/concurrent/executors.rb +1 -0
  29. data/lib/concurrent/future.rb +7 -29
  30. data/lib/concurrent/ivar.rb +9 -0
  31. data/lib/concurrent/logging.rb +3 -0
  32. data/lib/concurrent/mvar.rb +26 -9
  33. data/lib/concurrent/observable.rb +33 -0
  34. data/lib/concurrent/promise.rb +59 -1
  35. data/lib/concurrent/scheduled_task.rb +1 -0
  36. data/lib/concurrent/timer_task.rb +18 -18
  37. data/lib/concurrent/tvar.rb +2 -0
  38. data/lib/concurrent/version.rb +1 -1
  39. data/lib/concurrent_ruby_ext.so +0 -0
  40. metadata +21 -4
@@ -4,6 +4,7 @@ require 'concurrent/executor/safe_task_executor'
4
4
 
5
5
  module Concurrent
6
6
 
7
+ # {include:file:doc/scheduled_task.md}
7
8
  class ScheduledTask < IVar
8
9
 
9
10
  attr_reader :schedule_time
@@ -10,7 +10,7 @@ module Concurrent
10
10
  # intervals. The thread that performs the task sleeps for the given interval then
11
11
  # wakes up and performs the task. Lather, rinse, repeat... This pattern causes two
12
12
  # problems. First, it is difficult to test the business logic of the task because the
13
- # task itself is tightly coupled with the concurrency logic. Second, an exception in
13
+ # task itself is tightly coupled with the concurrency logic. Second, an exception
14
14
  # raised while performing the task can cause the entire thread to abend. In a
15
15
  # long-running application where the task thread is intended to run for days/weeks/years
16
16
  # a crashed task thread can pose a significant problem. `TimerTask` alleviates both problems.
@@ -23,13 +23,13 @@ module Concurrent
23
23
  # performing logging or ancillary operations. `TimerTask` can also be configured with a
24
24
  # timeout value allowing it to kill a task that runs too long.
25
25
  #
26
- # One other advantage of `TimerTask` is it forces the business logic to be completely decoupled
26
+ # One other advantage of `TimerTask` is that it forces the business logic to be completely decoupled
27
27
  # from the concurrency logic. The business logic can be tested separately then passed to the
28
28
  # `TimerTask` for scheduling and running.
29
29
  #
30
30
  # In some cases it may be necessary for a `TimerTask` to affect its own execution cycle.
31
- # To facilitate this a reference to the task object is passed into the block as a block
32
- # argument every time the task is executed.
31
+ # To facilitate this, a reference to the TimerTask instance is passed as an argument
32
+ # to the provided block every time the task is executed.
33
33
  #
34
34
  # The `TimerTask` class includes the `Dereferenceable` mixin module so the result of
35
35
  # the last execution is always available via the `#value` method. Derefencing options
@@ -39,13 +39,13 @@ module Concurrent
39
39
  # `TimerTask` supports notification through the Ruby standard library
40
40
  # {http://ruby-doc.org/stdlib-2.0/libdoc/observer/rdoc/Observable.html Observable}
41
41
  # module. On execution the `TimerTask` will notify the observers
42
- # with threes arguments: time of execution, the result of the block (or nil on failure),
42
+ # with three arguments: time of execution, the result of the block (or nil on failure),
43
43
  # and any raised exceptions (or nil on success). If the timeout interval is exceeded
44
44
  # the observer will receive a `Concurrent::TimeoutError` object as the third argument.
45
45
  #
46
46
  # @example Basic usage
47
47
  # task = Concurrent::TimerTask.new{ puts 'Boom!' }
48
- # task.run!
48
+ # task.execute
49
49
  #
50
50
  # task.execution_interval #=> 60 (default)
51
51
  # task.timeout_interval #=> 30 (default)
@@ -53,7 +53,7 @@ module Concurrent
53
53
  # # wait 60 seconds...
54
54
  # #=> 'Boom!'
55
55
  #
56
- # task.stop #=> true
56
+ # task.shutdown #=> true
57
57
  #
58
58
  # @example Configuring `:execution_interval` and `:timeout_interval`
59
59
  # task = Concurrent::TimerTask.new(execution_interval: 5, timeout_interval: 5) do
@@ -65,7 +65,7 @@ module Concurrent
65
65
  #
66
66
  # @example Immediate execution with `:run_now`
67
67
  # task = Concurrent::TimerTask.new(run_now: true){ puts 'Boom!' }
68
- # task.run!
68
+ # task.execute
69
69
  #
70
70
  # #=> 'Boom!'
71
71
  #
@@ -75,7 +75,7 @@ module Concurrent
75
75
  # execution_interval: 5
76
76
  # ){ Time.now }
77
77
  #
78
- # task.run!
78
+ # task.execute
79
79
  # Time.now #=> 2013-11-07 18:06:50 -0500
80
80
  # sleep(10)
81
81
  # task.value #=> 2013-11-07 18:06:55 -0500
@@ -87,11 +87,11 @@ module Concurrent
87
87
  # task.execution_interval += 1
88
88
  # if task.execution_interval > 5
89
89
  # puts 'Stopping...'
90
- # task.stop
90
+ # task.shutdown
91
91
  # end
92
92
  # end
93
93
  #
94
- # timer_task.run # blocking call - this task will stop itself
94
+ # timer_task.execute # blocking call - this task will stop itself
95
95
  # #=> Boom!
96
96
  # #=> Boom! Boom!
97
97
  # #=> Boom! Boom! Boom!
@@ -114,30 +114,30 @@ module Concurrent
114
114
  #
115
115
  # task = Concurrent::TimerTask.new(execution_interval: 1, timeout_interval: 1){ 42 }
116
116
  # task.add_observer(TaskObserver.new)
117
- # task.run!
117
+ # task.execute
118
118
  #
119
119
  # #=> (2013-10-13 19:08:58 -0400) Execution successfully returned 42
120
120
  # #=> (2013-10-13 19:08:59 -0400) Execution successfully returned 42
121
121
  # #=> (2013-10-13 19:09:00 -0400) Execution successfully returned 42
122
- # task.stop
122
+ # task.shutdown
123
123
  #
124
124
  # task = Concurrent::TimerTask.new(execution_interval: 1, timeout_interval: 1){ sleep }
125
125
  # task.add_observer(TaskObserver.new)
126
- # task.run!
126
+ # task.execute
127
127
  #
128
128
  # #=> (2013-10-13 19:07:25 -0400) Execution timed out
129
129
  # #=> (2013-10-13 19:07:27 -0400) Execution timed out
130
130
  # #=> (2013-10-13 19:07:29 -0400) Execution timed out
131
- # task.stop
131
+ # task.shutdown
132
132
  #
133
133
  # task = Concurrent::TimerTask.new(execution_interval: 1){ raise StandardError }
134
134
  # task.add_observer(TaskObserver.new)
135
- # task.run!
135
+ # task.execute
136
136
  #
137
137
  # #=> (2013-10-13 19:09:37 -0400) Execution failed with error StandardError
138
138
  # #=> (2013-10-13 19:09:38 -0400) Execution failed with error StandardError
139
139
  # #=> (2013-10-13 19:09:39 -0400) Execution failed with error StandardError
140
- # task.stop
140
+ # task.shutdown
141
141
  #
142
142
  # @see http://ruby-doc.org/stdlib-2.0/libdoc/observer/rdoc/Observable.html
143
143
  # @see http://docs.oracle.com/javase/7/docs/api/java/util/TimerTask.html
@@ -316,7 +316,7 @@ module Concurrent
316
316
  # @!visibility private
317
317
  def execute_task(completion)
318
318
  return unless @running.true?
319
- Concurrent::timer(timeout_interval, completion, &method(:timeout_task))
319
+ Concurrent::timer(execution_interval, completion, &method(:timeout_task))
320
320
  success, value, reason = @executor.execute(self)
321
321
  if completion.try?
322
322
  self.value = value
@@ -4,6 +4,8 @@ module Concurrent
4
4
 
5
5
  # A `TVar` is a transactional variable - a single-element container that
6
6
  # is used as part of a transaction - see `Concurrent::atomically`.
7
+ #
8
+ # {include:file:doc/tvar.md}
7
9
  class TVar
8
10
 
9
11
  # Create a new `TVar` with an initial value.
@@ -1,3 +1,3 @@
1
1
  module Concurrent
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
Binary file
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Jerry D'Antonio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-13 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ref
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.5
13
27
  description: ! " Modern concurrency tools including agents, futures, promises,
14
28
  thread pools, actors, supervisors, and more.\n Inspired by Erlang, Clojure, Go,
15
29
  JavaScript, actors, and classic concurrency patterns.\n"
@@ -19,7 +33,9 @@ extensions: []
19
33
  extra_rdoc_files:
20
34
  - README.md
21
35
  - LICENSE.txt
36
+ - CHANGELOG.md
22
37
  files:
38
+ - CHANGELOG.md
23
39
  - LICENSE.txt
24
40
  - README.md
25
41
  - ext/concurrent_ruby_ext/atomic_boolean.c
@@ -104,6 +120,7 @@ files:
104
120
  - lib/concurrent/executor/executor.rb
105
121
  - lib/concurrent/executor/fixed_thread_pool.rb
106
122
  - lib/concurrent/executor/immediate_executor.rb
123
+ - lib/concurrent/executor/indirect_immediate_executor.rb
107
124
  - lib/concurrent/executor/java_cached_thread_pool.rb
108
125
  - lib/concurrent/executor/java_fixed_thread_pool.rb
109
126
  - lib/concurrent/executor/java_single_thread_executor.rb
@@ -160,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
177
  version: '0'
161
178
  requirements: []
162
179
  rubyforge_project:
163
- rubygems_version: 2.2.2
180
+ rubygems_version: 2.4.4
164
181
  signing_key:
165
182
  specification_version: 4
166
183
  summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell,