concurrent-ruby 0.7.2-java → 0.8.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a22905c0d896596f7b3247122687f19e6f6967eb
4
+ data.tar.gz: 0c7b8b282b51f1a71c37df90da8eeb3aa7b614a9
5
+ SHA512:
6
+ metadata.gz: 63abed1c068d3c25930a6a60637d4ad5dc40121f091440850ab03214a7cf8e13fee800fc258a0ce93482462134728884081f88a013656778a8344255f8ceb048
7
+ data.tar.gz: 05670a25a6e3e6cd9c091e4b50ff13f506723383abb5e263039b4e90c01b2a392d2b2651179ae90f39f55b6e4b1538e65a5ffa606385e9c7d9491e627e9a5c63
@@ -1,4 +1,11 @@
1
- ### Next Release v0.7.2 (24 January 2015)
1
+ ### Next Release v0.8.0 (25 January 2015)
2
+
3
+ * C extension for MRI have been extracted into the `concurrent-ruby-ext` companion gem.
4
+ Please see the README for more detail.
5
+ * Better variable isolation in `Promise` and `Future` via an `:args` option
6
+ * Continued to update intermittently failing tests
7
+
8
+ ## Current Release v0.7.2 (24 January 2015)
2
9
 
3
10
  * New `Semaphore` class based on [java.util.concurrent.Semaphore](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Semaphore.html)
4
11
  * New `Promise.all?` and `Promise.any?` class methods
@@ -15,7 +22,7 @@
15
22
  * Tests now run on new Travis build environment
16
23
  * Multiple documentation updates
17
24
 
18
- ## Current Release v0.7.1 (4 December 2014)
25
+ ### Release v0.7.1 (4 December 2014)
19
26
 
20
27
  Please see the [roadmap](https://github.com/ruby-concurrency/concurrent-ruby/issues/142) for more information on the next planned release.
21
28
 
data/README.md CHANGED
@@ -37,10 +37,8 @@
37
37
 
38
38
  ### Supported Ruby versions
39
39
 
40
- MRI 1.9.3, 2.0, 2.1, JRuby (1.9 mode), and Rubinius 2.x are supported.
41
- Although native code is used for performance optimizations on some platforms, all functionality
42
- is available in pure Ruby. This gem should be fully compatible with any interpreter that is
43
- compliant with Ruby 1.9.3 or newer.
40
+ MRI 1.9.3, 2.0, 2.1, 2.2, JRuby (1.9 mode), and Rubinius 2.x are supported.
41
+ This gem should be fully compatible with any interpreter that is compliant with Ruby 1.9.3 or newer.
44
42
 
45
43
  ## Features & Documentation
46
44
 
@@ -62,6 +60,7 @@ This library contains a variety of concurrency abstractions at high and low leve
62
60
  * [Promise](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Promise.html): Similar to Futures, with more features.
63
61
  * [ScheduledTask](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ScheduledTask.html): Like a Future scheduled for a specific future time.
64
62
  * [TimerTask](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TimerTask.html): A Thread that periodically wakes up to perform work at regular intervals.
63
+ * [Channel](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Channel.html): Communicating Sequential Processes (CSP).
65
64
 
66
65
  ### Java-inspired ThreadPools and other executors
67
66
 
@@ -98,28 +97,45 @@ Lower-level abstractions mainly used as building blocks.
98
97
  * [thread-local variables](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ThreadLocalVar.html)
99
98
  * [software transactional memory](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TVar.html) (TVar)
100
99
 
101
- ## Installing and Building
100
+ ## Usage
102
101
 
103
- This gem includes several platform-specific optimizations. To reduce the possibility of
104
- compilation errors, we provide pre-compiled gem packages for several platforms as well
105
- as a pure-Ruby build. Installing the gem should be no different than installing any other
106
- Rubygems-hosted gem. Rubygems will automatically detect your platform and install the
107
- appropriate pre-compiled build. You should never see Rubygems attempt to compile the gem
108
- on installation. Additionally, to ensure compatability with the largest possible number
109
- of Ruby interpreters, the C extensions will *never* load under any Ruby other than MRI,
110
- even when installed.
102
+ All abstractions within this gem can be loaded simply by requiring it:
111
103
 
112
- The following gem builds will be built at every release:
104
+ ```ruby
105
+ require 'concurrent'
106
+ ```
107
+
108
+ To reduce the amount of code loaded at runtime, subsets of this gem can be required:
113
109
 
114
- * concurrent-ruby-x.y.z.gem (pure Ruby)
115
- * concurrent-ruby-x.y.z-java.gem (JRuby)
116
- * concurrent-ruby-x.y.z-x86-linux.gem (Linux 32-bit)
117
- * concurrent-ruby-x.y.z-x86_64-linux.gem (Linux 64-bit)
118
- * concurrent-ruby-x.y.z-x86-mingw32.gem (Windows 32-bit)
119
- * concurrent-ruby-x.y.z-x64-mingw32.gem (Windows 64-bit)
120
- * concurrent-ruby-x.y.z-x86-solaris-2.11.gem (Solaris)
110
+ ```ruby
111
+ require 'concurrent' # everything
112
+
113
+ # groups
114
+
115
+ require 'concurrent/actor' # Concurrent::Actor and supporting code
116
+ require 'concurrent/atomics' # atomic and thread synchronization classes
117
+ require 'concurrent/channels' # Concurrent::Channel and supporting code
118
+ require 'concurrent/executors' # Thread pools and other executors
119
+ require 'concurrent/utilities' # utility methods such as processor count and timers
120
+
121
+ # individual abstractions
122
+
123
+ require 'concurrent/agent' # Concurrent::Agent
124
+ require 'concurrent/async' # Concurrent::Async
125
+ require 'concurrent/atomic' # Concurrent::Atomic (formerly the `atomic` gem)
126
+ require 'concurrent/dataflow' # Concurrent::dataflow
127
+ require 'concurrent/delay' # Concurrent::Delay
128
+ require 'concurrent/exchanger' # Concurrent::Exchanger
129
+ require 'concurrent/future' # Concurrent::Future
130
+ require 'concurrent/ivar' # Concurrent::IVar
131
+ require 'concurrent/mvar' # Concurrent::MVar
132
+ require 'concurrent/promise' # Concurrent::Promise
133
+ require 'concurrent/scheduled_task' # Concurrent::ScheduledTask
134
+ require 'concurrent/timer_task' # Concurrent::TimerTask
135
+ require 'concurrent/tvar' # Concurrent::TVar
136
+ ```
121
137
 
122
- ### Installing
138
+ ## Installation
123
139
 
124
140
  ```shell
125
141
  gem install concurrent-ruby
@@ -133,31 +149,64 @@ gem 'concurrent-ruby'
133
149
 
134
150
  and run `bundle install` from your shell.
135
151
 
136
- ### Building
152
+ ### C Extensions for MRI
137
153
 
138
- Because we provide pre-compiled gem builds, users should never need to build the gem manually.
139
- The build process for this gem is completely automated using open source tools. All of
140
- the automation components are available in the [ruby-concurrency/rake-compiler-dev-box](https://github.com/ruby-concurrency/rake-compiler-dev-box)
141
- GitHub repository.
154
+ Potential performance improvements may be achieved under MRI by installing optional C extensions.
155
+ To minimize installation errors the C extensions are available in the `concurrent-ruby-ext` extension
156
+ gem. The extension gem lists `concurrent-ruby` as a dependency so it is not necessary to install both.
157
+ Simply install the extension gen:
142
158
 
143
- This gem will compile native C code under MRI and native Java code under JRuby. It is
144
- also possible to build a pure-Ruby version. All builds have identical functionality.
145
- The only difference is performance. Additionally, pure-Ruby classes are always available,
146
- even when using the native optimizations. Please see the [documentation](http://ruby-concurrency.github.io/concurrent-ruby/)
147
- for more details.
159
+ ```ruby
160
+ gem install concurrent-ruby-ext
161
+ ```
148
162
 
149
- To build and package the gem using MRI or JRuby, install the necessary build dependencies and run:
163
+ or add the following line to Gemfile:
150
164
 
151
- ```shell
152
- bundle exec rake compile
153
- bundle exec rake build
165
+ ```ruby
166
+ gem 'concurrent-ruby-ext'
167
+ ```
168
+
169
+ and run `bundle install` from your shell.
170
+
171
+ In code it is only necessary to
172
+
173
+ ```ruby
174
+ require 'concurrent'
154
175
  ```
155
176
 
156
- To build and package a pure-Ruby gem, on *any* platform and interpreter
157
- (including MRI and JRuby), run:
177
+ The `concurrent-ruby` gem will automatically detect the presence of the `concurrent-ruby-ext` gem
178
+ and load the appropriate C extensions.
158
179
 
159
- ```shell
160
- BUILD_PURE_RUBY='true' bundle exec rake build
180
+ #### Note For gem developers
181
+
182
+ No gems should depend on `concurrent-ruby-ext`. Doing so will force C extensions on your users.
183
+ The best practice is to depend on `concurrent-ruby` and let users to decide if they want C extensions.
184
+
185
+ ### Building
186
+
187
+ All published versions of this gem (core, extension, and several platform-specific packages) are compiled,
188
+ packaged, tested, and published using an open, [automated process](https://github.com/ruby-concurrency/rake-compiler-dev-box).
189
+ This process can also be used to create pre-compiled binaries of the extension gem for virtally
190
+ any platform. *Documentation is forthcoming...*
191
+
192
+ ```
193
+ *MRI only*
194
+ rake build:native # Build concurrent-ruby-ext-<version>-<platform>.gem into the pkg directory
195
+ rake compile:extension # Compile extension
196
+
197
+ *JRuby only*
198
+ rake build # Build JRuby-specific core gem (alias for `build:core`)
199
+ rake build:core # Build concurrent-ruby-<version>-java.gem into the pkg directory
200
+
201
+ *All except JRuby*
202
+ rake build # Build core and extension gems
203
+ rake build:core # Build concurrent-ruby-<version>.gem into the pkg directory
204
+ rake build:ext # Build concurrent-ruby-ext-<version>.gem into the pkg directory
205
+
206
+ *All*
207
+ rake clean # Remove any temporary products
208
+ rake clobber # Remove any generated file
209
+ rake compile # Compile all the extensions
161
210
  ```
162
211
 
163
212
  ## Maintainers
@@ -167,6 +216,7 @@ BUILD_PURE_RUBY='true' bundle exec rake build
167
216
  * [Chris Seaton](https://github.com/chrisseaton)
168
217
  * [Lucas Allan](https://github.com/lucasallan)
169
218
  * [Petr Chalupa](https://github.com/pitr-ch)
219
+ * [Paweł Obrok](https://github.com/obrok)
170
220
 
171
221
  ### Contributing
172
222
 
@@ -12,6 +12,7 @@ RUBY
12
12
  end
13
13
  #####################################################################
14
14
 
15
+ require_relative '../extension_helper'
15
16
  require 'concurrent/atomic_reference/concurrent_update_error'
16
17
  require 'concurrent/atomic_reference/mutex_atomic'
17
18
 
@@ -77,7 +78,7 @@ elsif defined? Concurrent::RbxAtomic
77
78
  class Concurrent::Atomic < Concurrent::RbxAtomic
78
79
  end
79
80
 
80
- elsif Concurrent.allow_c_native_class?('CAtomic')
81
+ elsif defined? Concurrent::CAtomic
81
82
 
82
83
  # @!macro atomic_reference
83
84
  class Concurrent::Atomic < Concurrent::CAtomic
@@ -1,5 +1,4 @@
1
1
  require_relative '../../extension_helper'
2
- Concurrent.safe_require_c_extensions
3
2
 
4
3
  module Concurrent
5
4
 
@@ -162,7 +161,7 @@ module Concurrent
162
161
  class AtomicBoolean < JavaAtomicBoolean
163
162
  end
164
163
 
165
- elsif Concurrent.allow_c_native_class?('CAtomicBoolean')
164
+ elsif defined?(CAtomicBoolean)
166
165
 
167
166
  # @!macro atomic_boolean
168
167
  class CAtomicBoolean
@@ -1,5 +1,4 @@
1
1
  require_relative '../../extension_helper'
2
- Concurrent.safe_require_c_extensions
3
2
 
4
3
  module Concurrent
5
4
 
@@ -166,7 +165,7 @@ module Concurrent
166
165
  class AtomicFixnum < JavaAtomicFixnum
167
166
  end
168
167
 
169
- elsif Concurrent.allow_c_native_class?('CAtomicFixnum')
168
+ elsif defined?(CAtomicFixnum)
170
169
 
171
170
  # @!macro atomic_fixnum
172
171
  class CAtomicFixnum
@@ -1,5 +1,4 @@
1
1
  require_relative '../../extension_helper'
2
- Concurrent.safe_require_java_extensions
3
2
 
4
3
  if defined?(Concurrent::JavaAtomic)
5
4
  require 'concurrent/atomic_reference/direct_update'
@@ -1,37 +1,29 @@
1
- require_relative '../../extension_helper'
1
+ if defined? Concurrent::CAtomic
2
+ require_relative '../../extension_helper'
3
+ require 'concurrent/atomic_reference/direct_update'
4
+ require 'concurrent/atomic_reference/numeric_cas_wrapper'
2
5
 
3
- if Concurrent.allow_c_extensions?
4
- begin
5
- require 'concurrent_ruby_ext'
6
- rescue LoadError
7
- # may be a Windows cross-compiled native gem
8
- require "#{RUBY_VERSION[0..2]}/concurrent_ruby_ext"
9
- end
10
- end
11
-
12
- require 'concurrent/atomic_reference/direct_update'
13
- require 'concurrent/atomic_reference/numeric_cas_wrapper'
14
-
15
- module Concurrent
6
+ module Concurrent
16
7
 
17
- # @!macro atomic_reference
18
- class CAtomic
19
- include Concurrent::AtomicDirectUpdate
20
- include Concurrent::AtomicNumericCompareAndSetWrapper
8
+ # @!macro atomic_reference
9
+ class CAtomic
10
+ include Concurrent::AtomicDirectUpdate
11
+ include Concurrent::AtomicNumericCompareAndSetWrapper
21
12
 
22
- # @!method initialize
23
- # @!macro atomic_reference_method_initialize
13
+ # @!method initialize
14
+ # @!macro atomic_reference_method_initialize
24
15
 
25
- # @!method get
26
- # @!macro atomic_reference_method_get
16
+ # @!method get
17
+ # @!macro atomic_reference_method_get
27
18
 
28
- # @!method set
29
- # @!macro atomic_reference_method_set
19
+ # @!method set
20
+ # @!macro atomic_reference_method_set
30
21
 
31
- # @!method get_and_set
32
- # @!macro atomic_reference_method_get_and_set
22
+ # @!method get_and_set
23
+ # @!macro atomic_reference_method_get_and_set
33
24
 
34
- # @!method _compare_and_set
35
- # @!macro atomic_reference_method_compare_and_set
25
+ # @!method _compare_and_set
26
+ # @!macro atomic_reference_method_compare_and_set
27
+ end
36
28
  end
37
29
  end
@@ -23,6 +23,8 @@ module Concurrent
23
23
  # global task pool (for short-running tasks)
24
24
  # @option opts [object] :executor when provided will run all operations on
25
25
  # this executor rather than the global thread pool (overrides :operation)
26
+ # @option opts [object, Array] :args zero or more arguments to be passed the task block on execution
27
+ #
26
28
  # @option opts [String] :dup_on_deref (false) call `#dup` before returning the data
27
29
  # @option opts [String] :freeze_on_deref (false) call `#freeze` before returning the data
28
30
  # @option opts [String] :copy_on_deref (nil) call the given `Proc` passing the internal value and
@@ -35,6 +37,7 @@ module Concurrent
35
37
  @state = :unscheduled
36
38
  @task = block
37
39
  @executor = OptionsParser::get_executor_from(opts) || Concurrent.configuration.global_operation_pool
40
+ @args = OptionsParser::get_arguments_from(opts)
38
41
  end
39
42
 
40
43
  # Execute an `:unscheduled` `Future`. Immediately sets the state to `:pending` and
@@ -52,11 +55,9 @@ module Concurrent
52
55
  # @example Instance and execute in one line
53
56
  # future = Concurrent::Future.new{ sleep(1); 42 }.execute
54
57
  # future.state #=> :pending
55
- #
56
- # @since 0.5.0
57
58
  def execute
58
59
  if compare_and_set_state(:pending, :unscheduled)
59
- @executor.post{ work }
60
+ @executor.post(@args){ work }
60
61
  self
61
62
  end
62
63
  end
@@ -72,6 +73,8 @@ module Concurrent
72
73
  # global task pool (for short-running tasks)
73
74
  # @option opts [object] :executor when provided will run all operations on
74
75
  # this executor rather than the global thread pool (overrides :operation)
76
+ # @option opts [object, Array] :args zero or more arguments to be passed the task block on execution
77
+ #
75
78
  # @option opts [String] :dup_on_deref (false) call `#dup` before returning the data
76
79
  # @option opts [String] :freeze_on_deref (false) call `#freeze` before returning the data
77
80
  # @option opts [String] :copy_on_deref (nil) call the given `Proc` passing the internal value and
@@ -84,8 +87,6 @@ module Concurrent
84
87
  # @example
85
88
  # future = Concurrent::Future.execute{ sleep(1); 42 }
86
89
  # future.state #=> :pending
87
- #
88
- # @since 0.5.0
89
90
  def self.execute(opts = {}, &block)
90
91
  Future.new(opts, &block).execute
91
92
  end
@@ -96,7 +97,7 @@ module Concurrent
96
97
 
97
98
  # @!visibility private
98
99
  def work # :nodoc:
99
- success, val, reason = SafeTaskExecutor.new(@task).execute
100
+ success, val, reason = SafeTaskExecutor.new(@task).execute(*@args)
100
101
  complete(success, val, reason)
101
102
  end
102
103
  end
@@ -23,6 +23,10 @@ module Concurrent
23
23
  end
24
24
  end
25
25
 
26
+ def get_arguments_from(opts = {})
27
+ [*opts.fetch(:args, [])]
28
+ end
29
+
26
30
  # Get the requested `Executor` based on the values set in the options hash.
27
31
  #
28
32
  # @param [Hash] opts the options defining the requested executor
@@ -172,22 +172,25 @@ module Concurrent
172
172
 
173
173
  # Initialize a new Promise with the provided options.
174
174
  #
175
- # @param [Hash] opts the options used to define the behavior at update and deref
175
+ # @!macro [attach] promise_init_options
176
176
  #
177
- # @option opts [Promise] :parent the parent `Promise` when building a chain/tree
178
- # @option opts [Proc] :on_fulfill fulfillment handler
179
- # @option opts [Proc] :on_reject rejection handler
177
+ # @param [Hash] opts the options used to define the behavior at update and deref
180
178
  #
181
- # @option opts [Boolean] :operation (false) when `true` will execute the future on the global
182
- # operation pool (for long-running operations), when `false` will execute the future on the
183
- # global task pool (for short-running tasks)
184
- # @option opts [object] :executor when provided will run all operations on
185
- # this executor rather than the global thread pool (overrides :operation)
179
+ # @option opts [Promise] :parent the parent `Promise` when building a chain/tree
180
+ # @option opts [Proc] :on_fulfill fulfillment handler
181
+ # @option opts [Proc] :on_reject rejection handler
186
182
  #
187
- # @option opts [String] :dup_on_deref (false) call `#dup` before returning the data
188
- # @option opts [String] :freeze_on_deref (false) call `#freeze` before returning the data
189
- # @option opts [String] :copy_on_deref (nil) call the given `Proc` passing the internal value and
190
- # returning the value returned from the proc
183
+ # @option opts [Boolean] :operation (false) when `true` will execute the future on the global
184
+ # operation pool (for long-running operations), when `false` will execute the future on the
185
+ # global task pool (for short-running tasks)
186
+ # @option opts [object] :executor when provided will run all operations on
187
+ # this executor rather than the global thread pool (overrides :operation)
188
+ # @option opts [object, Array] :args zero or more arguments to be passed the task block on execution
189
+ #
190
+ # @option opts [String] :dup_on_deref (false) call `#dup` before returning the data
191
+ # @option opts [String] :freeze_on_deref (false) call `#freeze` before returning the data
192
+ # @option opts [String] :copy_on_deref (nil) call the given `Proc` passing the internal value and
193
+ # returning the value returned from the proc
191
194
  #
192
195
  # @see http://wiki.commonjs.org/wiki/Promises/A
193
196
  # @see http://promises-aplus.github.io/promises-spec/
@@ -195,6 +198,8 @@ module Concurrent
195
198
  opts.delete_if { |k, v| v.nil? }
196
199
 
197
200
  @executor = OptionsParser::get_executor_from(opts) || Concurrent.configuration.global_operation_pool
201
+ @args = OptionsParser::get_arguments_from(opts)
202
+
198
203
  @parent = opts.fetch(:parent) { nil }
199
204
  @on_fulfill = opts.fetch(:on_fulfill) { Proc.new { |result| result } }
200
205
  @on_reject = opts.fetch(:on_reject) { Proc.new { |reason| raise reason } }
@@ -219,7 +224,6 @@ module Concurrent
219
224
  end
220
225
 
221
226
  # @return [Promise]
222
- # @since 0.5.0
223
227
  def execute
224
228
  if root?
225
229
  if compare_and_set_state(:pending, :unscheduled)
@@ -232,7 +236,18 @@ module Concurrent
232
236
  self
233
237
  end
234
238
 
235
- # @since 0.5.0
239
+ # Create a new `Promise` object with the given block, execute it, and return the
240
+ # `:pending` object.
241
+ #
242
+ # @!macro promise_init_options
243
+ #
244
+ # @return [Promise] the newly created `Promise` in the `:pending` state
245
+ #
246
+ # @raise [ArgumentError] if no block is given
247
+ #
248
+ # @example
249
+ # promise = Concurrent::Promise.execute{ sleep(1); 42 }
250
+ # promise.state #=> :pending
236
251
  def self.execute(opts = {}, &block)
237
252
  new(opts, &block).execute
238
253
  end
@@ -389,6 +404,7 @@ module Concurrent
389
404
  composite
390
405
  end
391
406
 
407
+ # @!visibility private
392
408
  def set_pending
393
409
  mutex.synchronize do
394
410
  @state = :pending
@@ -413,6 +429,7 @@ module Concurrent
413
429
  nil
414
430
  end
415
431
 
432
+ # @!visibility private
416
433
  def notify_child(child)
417
434
  if_state(:fulfilled) { child.on_fulfill(apply_deref_options(@value)) }
418
435
  if_state(:rejected) { child.on_reject(@reason) }
@@ -421,7 +438,7 @@ module Concurrent
421
438
  # @!visibility private
422
439
  def realize(task)
423
440
  @executor.post do
424
- success, value, reason = SafeTaskExecutor.new(task).execute
441
+ success, value, reason = SafeTaskExecutor.new(task).execute(*@args)
425
442
 
426
443
  children_to_notify = mutex.synchronize do
427
444
  set_state!(success, value, reason)
@@ -432,11 +449,13 @@ module Concurrent
432
449
  end
433
450
  end
434
451
 
452
+ # @!visibility private
435
453
  def set_state!(success, value, reason)
436
454
  set_state(success, value, reason)
437
455
  event.set
438
456
  end
439
457
 
458
+ # @!visibility private
440
459
  def synchronized_set_state!(success, value, reason)
441
460
  mutex.lock
442
461
  set_state!(success, value, reason)
@@ -1,3 +1,3 @@
1
1
  module Concurrent
2
- VERSION = '0.7.2'
2
+ VERSION = '0.8.0'
3
3
  end
Binary file
@@ -1,28 +1,37 @@
1
1
  module Concurrent
2
2
 
3
+ @@c_ext_loaded ||= false
4
+ @@java_ext_loaded ||= false
5
+
3
6
  # @!visibility private
4
7
  def self.allow_c_extensions?
5
8
  defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
6
9
  end
7
10
 
8
11
  # @!visibility private
9
- def self.allow_c_native_class?(clazz)
10
- allow_c_extensions? && Concurrent.const_defined?(clazz)
11
- rescue
12
- false
12
+ def self.jruby?
13
+ RUBY_PLATFORM == 'java'
13
14
  end
14
15
 
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.'
16
+ if allow_c_extensions? && !@@c_ext_loaded
17
+ begin
18
+ require 'concurrent/extension'
19
+ @@c_ext_loaded = true
20
+ rescue LoadError
21
+ # may be a Windows cross-compiled native gem
22
+ begin
23
+ require "concurrent/#{RUBY_VERSION[0..2]}/extension"
24
+ @@c_ext_loaded = true
25
+ rescue LoadError
26
+ warn 'Performance on MRI may be improved with the concurrent-ruby-ext gem. Please see http://concurrent-ruby.com'
27
+ end
28
+ end
29
+ elsif jruby? && !@@java_ext_loaded
30
+ begin
31
+ require 'concurrent_ruby_ext'
32
+ @@java_ext_loaded = true
33
+ rescue LoadError
34
+ warn 'Performance on JRuby may be improved by installing the pre-compiled Java extensions. Please see http://concurrent-ruby.com'
35
+ end
27
36
  end
28
37
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
5
- prerelease:
4
+ version: 0.8.0
6
5
  platform: java
7
6
  authors:
8
7
  - Jerry D'Antonio
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-01-24 00:00:00.000000000 Z
11
+ date: 2015-01-25 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: |2
15
14
  Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
@@ -22,51 +21,12 @@ extra_rdoc_files:
22
21
  - LICENSE.txt
23
22
  - CHANGELOG.md
24
23
  files:
24
+ - CHANGELOG.md
25
+ - LICENSE.txt
26
+ - README.md
25
27
  - lib/concurrent.rb
26
- - lib/concurrent_ruby.rb
27
- - lib/concurrent_ruby_ext.so
28
- - lib/extension_helper.rb
29
28
  - lib/concurrent/actor.rb
30
- - lib/concurrent/actress.rb
31
- - lib/concurrent/agent.rb
32
- - lib/concurrent/async.rb
33
- - lib/concurrent/atomic.rb
34
- - lib/concurrent/atomics.rb
35
- - lib/concurrent/channels.rb
36
- - lib/concurrent/collections.rb
37
- - lib/concurrent/configuration.rb
38
- - lib/concurrent/dataflow.rb
39
- - lib/concurrent/delay.rb
40
- - lib/concurrent/dereferenceable.rb
41
- - lib/concurrent/errors.rb
42
- - lib/concurrent/exchanger.rb
43
- - lib/concurrent/executors.rb
44
- - lib/concurrent/future.rb
45
- - lib/concurrent/ivar.rb
46
- - lib/concurrent/lazy_register.rb
47
- - lib/concurrent/logging.rb
48
- - lib/concurrent/mvar.rb
49
- - lib/concurrent/obligation.rb
50
- - lib/concurrent/observable.rb
51
- - lib/concurrent/options_parser.rb
52
- - lib/concurrent/promise.rb
53
- - lib/concurrent/scheduled_task.rb
54
- - lib/concurrent/timer_task.rb
55
- - lib/concurrent/tvar.rb
56
- - lib/concurrent/utilities.rb
57
- - lib/concurrent/version.rb
58
29
  - lib/concurrent/actor/behaviour.rb
59
- - lib/concurrent/actor/context.rb
60
- - lib/concurrent/actor/core.rb
61
- - lib/concurrent/actor/default_dead_letter_handler.rb
62
- - lib/concurrent/actor/envelope.rb
63
- - lib/concurrent/actor/errors.rb
64
- - lib/concurrent/actor/internal_delegations.rb
65
- - lib/concurrent/actor/public_delegations.rb
66
- - lib/concurrent/actor/reference.rb
67
- - lib/concurrent/actor/root.rb
68
- - lib/concurrent/actor/type_check.rb
69
- - lib/concurrent/actor/utils.rb
70
30
  - lib/concurrent/actor/behaviour/abstract.rb
71
31
  - lib/concurrent/actor/behaviour/awaits.rb
72
32
  - lib/concurrent/actor/behaviour/buffer.rb
@@ -80,10 +40,25 @@ files:
80
40
  - lib/concurrent/actor/behaviour/supervising.rb
81
41
  - lib/concurrent/actor/behaviour/terminates_children.rb
82
42
  - lib/concurrent/actor/behaviour/termination.rb
43
+ - lib/concurrent/actor/context.rb
44
+ - lib/concurrent/actor/core.rb
45
+ - lib/concurrent/actor/default_dead_letter_handler.rb
46
+ - lib/concurrent/actor/envelope.rb
47
+ - lib/concurrent/actor/errors.rb
48
+ - lib/concurrent/actor/internal_delegations.rb
49
+ - lib/concurrent/actor/public_delegations.rb
50
+ - lib/concurrent/actor/reference.rb
51
+ - lib/concurrent/actor/root.rb
52
+ - lib/concurrent/actor/type_check.rb
53
+ - lib/concurrent/actor/utils.rb
83
54
  - lib/concurrent/actor/utils/ad_hoc.rb
84
55
  - lib/concurrent/actor/utils/balancer.rb
85
56
  - lib/concurrent/actor/utils/broadcast.rb
86
57
  - lib/concurrent/actor/utils/pool.rb
58
+ - lib/concurrent/actress.rb
59
+ - lib/concurrent/agent.rb
60
+ - lib/concurrent/async.rb
61
+ - lib/concurrent/atomic.rb
87
62
  - lib/concurrent/atomic/atomic_boolean.rb
88
63
  - lib/concurrent/atomic/atomic_fixnum.rb
89
64
  - lib/concurrent/atomic/condition.rb
@@ -102,13 +77,22 @@ files:
102
77
  - lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
103
78
  - lib/concurrent/atomic_reference/rbx.rb
104
79
  - lib/concurrent/atomic_reference/ruby.rb
80
+ - lib/concurrent/atomics.rb
105
81
  - lib/concurrent/channel/buffered_channel.rb
106
82
  - lib/concurrent/channel/channel.rb
107
83
  - lib/concurrent/channel/unbuffered_channel.rb
108
84
  - lib/concurrent/channel/waitable_list.rb
85
+ - lib/concurrent/channels.rb
109
86
  - lib/concurrent/collection/blocking_ring_buffer.rb
110
87
  - lib/concurrent/collection/priority_queue.rb
111
88
  - lib/concurrent/collection/ring_buffer.rb
89
+ - lib/concurrent/collections.rb
90
+ - lib/concurrent/configuration.rb
91
+ - lib/concurrent/dataflow.rb
92
+ - lib/concurrent/delay.rb
93
+ - lib/concurrent/dereferenceable.rb
94
+ - lib/concurrent/errors.rb
95
+ - lib/concurrent/exchanger.rb
112
96
  - lib/concurrent/executor/cached_thread_pool.rb
113
97
  - lib/concurrent/executor/executor.rb
114
98
  - lib/concurrent/executor/fixed_thread_pool.rb
@@ -129,16 +113,31 @@ files:
129
113
  - lib/concurrent/executor/single_thread_executor.rb
130
114
  - lib/concurrent/executor/thread_pool_executor.rb
131
115
  - lib/concurrent/executor/timer_set.rb
116
+ - lib/concurrent/executors.rb
117
+ - lib/concurrent/future.rb
118
+ - lib/concurrent/ivar.rb
119
+ - lib/concurrent/lazy_register.rb
120
+ - lib/concurrent/logging.rb
121
+ - lib/concurrent/mvar.rb
122
+ - lib/concurrent/obligation.rb
123
+ - lib/concurrent/observable.rb
124
+ - lib/concurrent/options_parser.rb
125
+ - lib/concurrent/promise.rb
126
+ - lib/concurrent/scheduled_task.rb
127
+ - lib/concurrent/timer_task.rb
128
+ - lib/concurrent/tvar.rb
129
+ - lib/concurrent/utilities.rb
132
130
  - lib/concurrent/utility/processor_count.rb
133
131
  - lib/concurrent/utility/timeout.rb
134
132
  - lib/concurrent/utility/timer.rb
135
- - README.md
136
- - LICENSE.txt
137
- - CHANGELOG.md
133
+ - lib/concurrent/version.rb
134
+ - lib/concurrent_ruby.rb
138
135
  - lib/concurrent_ruby_ext.jar
136
+ - lib/extension_helper.rb
139
137
  homepage: http://www.concurrent-ruby.com
140
138
  licenses:
141
139
  - MIT
140
+ metadata: {}
142
141
  post_install_message:
143
142
  rdoc_options: []
144
143
  require_paths:
@@ -148,20 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
147
  - - '>='
149
148
  - !ruby/object:Gem::Version
150
149
  version: 1.9.3
151
- none: false
152
150
  required_rubygems_version: !ruby/object:Gem::Requirement
153
151
  requirements:
154
152
  - - '>='
155
153
  - !ruby/object:Gem::Version
156
154
  version: '0'
157
- hash: 2
158
- segments:
159
- - 0
160
- none: false
161
155
  requirements: []
162
156
  rubyforge_project:
163
- rubygems_version: 1.8.25
157
+ rubygems_version: 2.4.5
164
158
  signing_key:
165
- specification_version: 3
159
+ specification_version: 4
166
160
  summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.
167
161
  test_files: []
Binary file