concurrent-ruby 0.7.0.rc2-java → 0.7.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +138 -0
- data/README.md +108 -95
- data/lib/concurrent/actor.rb +12 -13
- data/lib/concurrent/actor/behaviour/errors_on_unknown_message.rb +1 -1
- data/lib/concurrent/actor/behaviour/executes_context.rb +1 -1
- data/lib/concurrent/actor/behaviour/linking.rb +4 -1
- data/lib/concurrent/actor/behaviour/pausing.rb +2 -2
- data/lib/concurrent/actor/behaviour/supervised.rb +3 -2
- data/lib/concurrent/actor/behaviour/terminates_children.rb +1 -1
- data/lib/concurrent/actor/behaviour/termination.rb +1 -1
- data/lib/concurrent/actor/context.rb +2 -1
- data/lib/concurrent/actor/core.rb +8 -4
- data/lib/concurrent/actor/utils.rb +10 -0
- data/lib/concurrent/actor/utils/ad_hoc.rb +21 -0
- data/lib/concurrent/actor/utils/balancer.rb +42 -0
- data/lib/concurrent/actor/utils/broadcast.rb +22 -6
- data/lib/concurrent/actor/utils/pool.rb +59 -0
- data/lib/concurrent/agent.rb +1 -22
- data/lib/concurrent/async.rb +1 -79
- data/lib/concurrent/atomic.rb +20 -26
- data/lib/concurrent/atomic/atomic_boolean.rb +4 -1
- data/lib/concurrent/atomic/atomic_fixnum.rb +4 -1
- data/lib/concurrent/atomic/thread_local_var.rb +71 -24
- data/lib/concurrent/atomic_reference/jruby.rb +10 -6
- data/lib/concurrent/atomic_reference/ruby.rb +14 -10
- data/lib/concurrent/atomics.rb +0 -1
- data/lib/concurrent/configuration.rb +11 -5
- data/lib/concurrent/dataflow.rb +1 -30
- data/lib/concurrent/dereferenceable.rb +9 -2
- data/lib/concurrent/executor/indirect_immediate_executor.rb +46 -0
- data/lib/concurrent/executor/java_thread_pool_executor.rb +2 -4
- data/lib/concurrent/executor/ruby_thread_pool_executor.rb +24 -22
- data/lib/concurrent/executor/serialized_execution.rb +36 -23
- data/lib/concurrent/executor/thread_pool_executor.rb +2 -0
- data/lib/concurrent/executor/timer_set.rb +7 -8
- data/lib/concurrent/executors.rb +1 -0
- data/lib/concurrent/future.rb +7 -29
- data/lib/concurrent/ivar.rb +9 -0
- data/lib/concurrent/logging.rb +3 -0
- data/lib/concurrent/mvar.rb +26 -9
- data/lib/concurrent/observable.rb +33 -0
- data/lib/concurrent/promise.rb +59 -1
- data/lib/concurrent/scheduled_task.rb +1 -0
- data/lib/concurrent/timer_task.rb +18 -18
- data/lib/concurrent/tvar.rb +3 -1
- data/lib/concurrent/version.rb +1 -1
- data/lib/concurrent_ruby_ext.jar +0 -0
- data/lib/concurrent_ruby_ext.so +0 -0
- data/lib/extension_helper.rb +25 -6
- metadata +15 -7
- data/lib/concurrent/actor/ad_hoc.rb +0 -19
- data/lib/concurrent/actor/utills.rb +0 -7
data/lib/concurrent/tvar.rb
CHANGED
@@ -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.
|
@@ -112,7 +114,7 @@ module Concurrent
|
|
112
114
|
result = Transaction::ABORTED
|
113
115
|
rescue => e
|
114
116
|
transaction.abort
|
115
|
-
|
117
|
+
raise e
|
116
118
|
end
|
117
119
|
# If we can commit, break out of the loop
|
118
120
|
|
data/lib/concurrent/version.rb
CHANGED
data/lib/concurrent_ruby_ext.jar
CHANGED
Binary file
|
data/lib/concurrent_ruby_ext.so
CHANGED
Binary file
|
data/lib/extension_helper.rb
CHANGED
@@ -1,9 +1,28 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
1
|
module Concurrent
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
(
|
2
|
+
|
3
|
+
# @!visibility private
|
4
|
+
def self.allow_c_extensions?
|
5
|
+
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
|
6
|
+
end
|
7
|
+
|
8
|
+
# @!visibility private
|
9
|
+
def self.allow_c_native_class?(clazz)
|
10
|
+
allow_c_extensions? && Concurrent.const_defined?(clazz)
|
11
|
+
rescue
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
# @!visibility private
|
16
|
+
def self.safe_require_c_extensions
|
17
|
+
require 'concurrent_ruby_ext' if allow_c_extensions?
|
18
|
+
rescue LoadError
|
19
|
+
#warn 'Attempted to load C extensions on unsupported platform. Continuing with pure-Ruby.'
|
20
|
+
end
|
21
|
+
|
22
|
+
# @!visibility private
|
23
|
+
def self.safe_require_java_extensions
|
24
|
+
require 'concurrent_ruby_ext' if RUBY_PLATFORM == 'java'
|
25
|
+
rescue LoadError
|
26
|
+
#warn 'Attempted to load Java extensions on unsupported platform. Continuing with pure-Ruby.'
|
8
27
|
end
|
9
28
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concurrent-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.1
|
5
|
+
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Jerry D'Antonio
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: |2
|
15
15
|
Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
|
@@ -20,6 +20,7 @@ extensions: []
|
|
20
20
|
extra_rdoc_files:
|
21
21
|
- README.md
|
22
22
|
- LICENSE.txt
|
23
|
+
- CHANGELOG.md
|
23
24
|
files:
|
24
25
|
- lib/concurrent.rb
|
25
26
|
- lib/concurrent_ruby.rb
|
@@ -54,7 +55,6 @@ files:
|
|
54
55
|
- lib/concurrent/tvar.rb
|
55
56
|
- lib/concurrent/utilities.rb
|
56
57
|
- lib/concurrent/version.rb
|
57
|
-
- lib/concurrent/actor/ad_hoc.rb
|
58
58
|
- lib/concurrent/actor/behaviour.rb
|
59
59
|
- lib/concurrent/actor/context.rb
|
60
60
|
- lib/concurrent/actor/core.rb
|
@@ -66,7 +66,7 @@ files:
|
|
66
66
|
- lib/concurrent/actor/reference.rb
|
67
67
|
- lib/concurrent/actor/root.rb
|
68
68
|
- lib/concurrent/actor/type_check.rb
|
69
|
-
- lib/concurrent/actor/
|
69
|
+
- lib/concurrent/actor/utils.rb
|
70
70
|
- lib/concurrent/actor/behaviour/abstract.rb
|
71
71
|
- lib/concurrent/actor/behaviour/awaits.rb
|
72
72
|
- lib/concurrent/actor/behaviour/buffer.rb
|
@@ -80,7 +80,10 @@ files:
|
|
80
80
|
- lib/concurrent/actor/behaviour/supervising.rb
|
81
81
|
- lib/concurrent/actor/behaviour/terminates_children.rb
|
82
82
|
- lib/concurrent/actor/behaviour/termination.rb
|
83
|
+
- lib/concurrent/actor/utils/ad_hoc.rb
|
84
|
+
- lib/concurrent/actor/utils/balancer.rb
|
83
85
|
- lib/concurrent/actor/utils/broadcast.rb
|
86
|
+
- lib/concurrent/actor/utils/pool.rb
|
84
87
|
- lib/concurrent/atomic/atomic_boolean.rb
|
85
88
|
- lib/concurrent/atomic/atomic_fixnum.rb
|
86
89
|
- lib/concurrent/atomic/condition.rb
|
@@ -109,6 +112,7 @@ files:
|
|
109
112
|
- lib/concurrent/executor/executor.rb
|
110
113
|
- lib/concurrent/executor/fixed_thread_pool.rb
|
111
114
|
- lib/concurrent/executor/immediate_executor.rb
|
115
|
+
- lib/concurrent/executor/indirect_immediate_executor.rb
|
112
116
|
- lib/concurrent/executor/java_cached_thread_pool.rb
|
113
117
|
- lib/concurrent/executor/java_fixed_thread_pool.rb
|
114
118
|
- lib/concurrent/executor/java_single_thread_executor.rb
|
@@ -129,6 +133,7 @@ files:
|
|
129
133
|
- lib/concurrent/utility/timer.rb
|
130
134
|
- README.md
|
131
135
|
- LICENSE.txt
|
136
|
+
- CHANGELOG.md
|
132
137
|
- lib/concurrent_ruby_ext.jar
|
133
138
|
homepage: http://www.concurrent-ruby.com
|
134
139
|
licenses:
|
@@ -145,9 +150,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
150
|
none: false
|
146
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
152
|
requirements:
|
148
|
-
- - '
|
153
|
+
- - '>='
|
149
154
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
155
|
+
version: '0'
|
156
|
+
hash: 2
|
157
|
+
segments:
|
158
|
+
- 0
|
151
159
|
none: false
|
152
160
|
requirements: []
|
153
161
|
rubyforge_project:
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Concurrent
|
2
|
-
module Actor
|
3
|
-
# Allows quick creation of actors with behaviour defined by blocks.
|
4
|
-
# @example ping
|
5
|
-
# AdHoc.spawn :forward, an_actor do |where|
|
6
|
-
# # this block has to return proc defining #on_message behaviour
|
7
|
-
# -> message { where.tell message }
|
8
|
-
# end
|
9
|
-
class AdHoc < Context
|
10
|
-
def initialize(*args, &initializer)
|
11
|
-
@on_message = Type! initializer.call(*args), Proc
|
12
|
-
end
|
13
|
-
|
14
|
-
def on_message(message)
|
15
|
-
instance_exec message, &@on_message
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|