concurrent-ruby-ext 0.8.0 → 0.9.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d91d97b5f512d1c7c27e0623e5aceb3e7390b6d
4
- data.tar.gz: 20cb737e88bae4aaf634deae96652bd299d82a4a
3
+ metadata.gz: 5db5d3a4081b567da10c4e3b65fdf3a1419ca3bf
4
+ data.tar.gz: 432dfbcabb9af5a98edc844d32482396db63a8dd
5
5
  SHA512:
6
- metadata.gz: 67314b7fd6f32ace58ec5b09d078ba52a5d8b262081d0550d5a475f85730dbb16a2a72d8053faa8f37764085d3b3666726443556e9fee9696d5ec5d355bb98a9
7
- data.tar.gz: 898eefbb3a04b61121099b25c36891701912e51949b754d9119efdbd2ef7f656e2162bbcdf1570b09144bdcbaf9aa0b48b9d0b731a1faf03789e7958c5278d2a
6
+ metadata.gz: d8597be5e0f0a1d17033f5562e29557106f566848b7b3e38cd9e537b036e5217f6eaeca0bc4a3e0eb6e03dda2acfddee7aeb70eef17068c7a563582c5c2b07a6
7
+ data.tar.gz: aa08718809471ddeb1510e3afb1c8cb1e5bae59d1117cf3e068cc70bdae2b968beb9176a86cb040abff8f3eee8fa661bc147b4e02a2c563ee41f190ccaff399d
data/CHANGELOG.md CHANGED
@@ -1,11 +1,106 @@
1
- ### Next Release v0.8.0 (25 January 2015)
1
+ ### Next Release v0.9.0 (Target Date: 7 June 2015)
2
+
3
+ * Pure Java implementations of
4
+ - `AtomicBoolean`
5
+ - `AtomicFixnum`
6
+ - `Semaphore`
7
+ * Fixed bug when pruning Ruby thread pools
8
+ * Fixed bug in time calculations within `ScheduledTask`
9
+ * Default `count` in `CountDownLatch` to 1
10
+ * Use monotonic clock for all timers via `Concurrent.monotonic_time`
11
+ - Use `Process.clock_gettime(Process::CLOCK_MONOTONIC)` when available
12
+ - Fallback to `java.lang.System.nanoTime()` on unsupported JRuby versions
13
+ - Pure Ruby implementation for everything else
14
+ - Effects `Concurrent.timer`, `Concurrent.timeout`, `TimerSet`, `TimerTask`, and `ScheduledTask`
15
+ * Deprecated all clock-time based timer scheduling
16
+ - Only support scheduling by delay
17
+ - Effects `Concurrent.timer`, `TimerSet`, and `ScheduledTask`
18
+ * Added new `ReadWriteLock` class
19
+ * Consistent `at_exit` behavior for Java and Ruby thread pools.
20
+ * Added `at_exit` handler to Ruby thread pools (already in Java thread pools)
21
+ - Ruby handler stores the object id and retrieves from `ObjectSpace`
22
+ - JRuby disables `ObjectSpace` by default so that handler stores the object reference
23
+ * Added a `:stop_on_exit` option to thread pools to enable/disable `at_exit` handler
24
+ * Updated thread pool docs to better explain shutting down thread pools
25
+ * Simpler `:executor` option syntax for all abstractions which support this option
26
+ * Added `Executor#auto_terminate?` predicate method (for thread pools)
27
+ * Added `at_exit` handler to `TimerSet`
28
+ * Simplified auto-termination of the global executors
29
+ - Can now disable auto-termination of global executors
30
+ - Added shutdown/kill/wait_for_termination variants for global executors
31
+ * Can now disable auto-termination for *all* executors (the nuclear option)
32
+ * Simplified auto-termination of the global executors
33
+ * Deprecated terms "task pool" and "operation pool"
34
+ - New terms are "io executor" and "fast executor"
35
+ - New functions added with new names
36
+ - Deprecation warnings added to functions referencing old names
37
+ * Moved all thread pool related functions from `Concurrent::Configuration` to `Concurrent`
38
+ - Old functions still exist with deprecation warnings
39
+ - New functions have updated names as appropriate
40
+ * All high-level abstractions default to the "io executor"
41
+ * Fixed bug in `Actor` causing it to prematurely warm global thread pools on gem load
42
+ - This also fixed a `RejectedExecutionError` bug when running with minitest/autorun via JRuby
43
+ * Moved global logger up to the `Concurrent` namespace and refactored the code
44
+ * Optimized the performance of `Delay`
45
+ - Fixed a bug in which no executor option on construction caused block execution on a global thread pool
46
+ * Numerous improvements and bug fixes to `TimerSet`
47
+ * Fixed deadlock of `Future` when the handler raises Exception
48
+ * Added shared specs for more classes
49
+ * New concurrency abstractions including:
50
+ - `Atom`
51
+ - `Maybe`
52
+ - `ImmutableStruct`
53
+ - `MutableStruct`
54
+ - `SettableStruct`
55
+ * Created an Edge gem for unstable abstractions including
56
+ - `Actor`
57
+ - `Agent`
58
+ - `Channel`
59
+ - `Exchanger`
60
+ - `LazyRegister`
61
+ - **new Future Framework** <http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge.html> - unified
62
+ implementation of Futures and Promises which combines Features of previous `Future`,
63
+ `Promise`, `IVar`, `Event`, `Probe`, `dataflow`, `Delay`, `TimerTask` into single framework. It uses extensively
64
+ new synchronization layer to make all the paths **lock-free** with exception of blocking threads on `#wait`.
65
+ It offers better performance and does not block threads when not required.
66
+ * Actor framework changes:
67
+ - fixed reset loop in Pool
68
+ - Pool can use any actor as a worker, abstract worker class is no longer needed.
69
+ - Actor events not have format `[:event_name, *payload]` instead of just the Symbol.
70
+ - Actor now uses new Future/Promise Framework instead of `IVar` for better interoperability
71
+ - Behaviour definition array was simplified to `[BehaviourClass1, [BehaviourClass2, *initialization_args]]`
72
+ - Linking behavior responds to :linked message by returning array of linked actors
73
+ - Supervised behavior is removed in favour of just Linking
74
+ - RestartingContext is supervised by default now, `supervise: true` is not required any more
75
+ - Events can be private and public, so far only difference is that Linking will
76
+ pass to linked actors only public messages. Adding private :restarting and
77
+ :resetting events which are send before the actor restarts or resets allowing
78
+ to add callbacks to cleanup current child actors.
79
+ - Print also object_id in Reference to_s
80
+ - Add AbstractContext#default_executor to be able to override executor class wide
81
+ - Add basic IO example
82
+ - Documentation somewhat improved
83
+ - All messages should have same priority. It's now possible to send `actor << job1 << job2 << :terminate!` and
84
+ be sure that both jobs are processed first.
85
+ * Refactored `Channel` to use newer synchronization objects
86
+ * Added `#reset` and `#cancel` methods to `TimerSet`
87
+ * Added `#cancel` method to `Future` and `ScheduledTask`
88
+ * Refactored `TimerSet` to use `ScheduledTask`
89
+ * Updated `Async` with a factory that initializes the object
90
+ * Deprecated `Concurrent.timer` and `Concurrent.timeout`
91
+ * Reduced max threads on pure-Ruby thread pools (abends around 14751 threads)
92
+ * Moved many private/internal classes/modules into "namespace" modules
93
+ * Removed brute-force killing of threads in tests
94
+ * Fixed a thread pool bug when the operating system cannot allocate more threads
95
+
96
+ ## Current Release v0.8.0 (25 January 2015)
2
97
 
3
98
  * C extension for MRI have been extracted into the `concurrent-ruby-ext` companion gem.
4
99
  Please see the README for more detail.
5
100
  * Better variable isolation in `Promise` and `Future` via an `:args` option
6
101
  * Continued to update intermittently failing tests
7
102
 
8
- ## Current Release v0.7.2 (24 January 2015)
103
+ ### Release v0.7.2 (24 January 2015)
9
104
 
10
105
  * New `Semaphore` class based on [java.util.concurrent.Semaphore](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Semaphore.html)
11
106
  * New `Promise.all?` and `Promise.any?` class methods
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Concurrent Ruby
2
- [![Gem Version](https://badge.fury.io/rb/concurrent-ruby.svg)](http://badge.fury.io/rb/concurrent-ruby) [![Build Status](https://travis-ci.org/ruby-concurrency/concurrent-ruby.svg?branch=master)](https://travis-ci.org/ruby-concurrency/concurrent-ruby) [![Coverage Status](https://img.shields.io/coveralls/ruby-concurrency/concurrent-ruby/master.svg)](https://coveralls.io/r/ruby-concurrency/concurrent-ruby) [![Code Climate](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby.svg)](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby) [![Inline docs](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby.svg)](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby) [![Dependency Status](https://gemnasium.com/ruby-concurrency/concurrent-ruby.svg)](https://gemnasium.com/ruby-concurrency/concurrent-ruby) [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT) [![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)
2
+ [![Gem Version](https://badge.fury.io/rb/concurrent-ruby.svg)](http://badge.fury.io/rb/concurrent-ruby) [![Build Status](https://travis-ci.org/ruby-concurrency/concurrent-ruby.svg?branch=master)](https://travis-ci.org/ruby-concurrency/concurrent-ruby) [![Code Climate](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby.svg)](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby) [![Inline docs](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby.svg)](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby) [![Dependency Status](https://gemnasium.com/ruby-concurrency/concurrent-ruby.svg)](https://gemnasium.com/ruby-concurrency/concurrent-ruby) [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT) [![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)
3
3
 
4
4
  <table>
5
5
  <tr>
@@ -50,52 +50,91 @@ We also have a [mailing list](http://groups.google.com/group/concurrent-ruby).
50
50
 
51
51
  This library contains a variety of concurrency abstractions at high and low levels. One of the high-level abstractions is likely to meet most common needs.
52
52
 
53
- ### High-level, general-purpose asynchronous concurrency abstractions
53
+ #### General-purpose Concurrency Abstractions
54
54
 
55
- * [Actor](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Actor.html): Implements the Actor Model, where concurrent actors exchange messages.
56
- * [Agent](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Agent.html): A single atomic value that represents an identity.
57
55
  * [Async](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Async.html): A mixin module that provides simple asynchronous behavior to any standard class/object or object.
56
+ * [Atom](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Atom.html): A way to manage shared, synchronous, independent state.
58
57
  * [Future](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Future.html): An asynchronous operation that produces a value.
59
- * [Dataflow](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Dataflow.html): Built on Futures, Dataflow allows you to create a task that will be scheduled when all of its data dependencies are available.
58
+ * [Dataflow](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent.html#dataflow-class_method): Built on Futures, Dataflow allows you to create a task that will be scheduled when all of its data dependencies are available.
60
59
  * [Promise](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Promise.html): Similar to Futures, with more features.
61
60
  * [ScheduledTask](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ScheduledTask.html): Like a Future scheduled for a specific future time.
62
61
  * [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).
64
62
 
65
- ### Java-inspired ThreadPools and other executors
63
+ #### Thread-safe Value Objects
66
64
 
67
- * See [ThreadPool](http://ruby-concurrency.github.io/concurrent-ruby/file.thread_pools.html) overview, which also contains a list of other Executors available.
65
+ * `Maybe` A thread-safe, immutable object representing an optional value, based on
66
+ [Haskell Data.Maybe](https://hackage.haskell.org/package/base-4.2.0.1/docs/Data-Maybe.html).
67
+ * `Delay` Lazy evaluation of a block yielding an immutable result. Based on Clojure's
68
+ [delay](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Delay.html).
68
69
 
69
- ### Thread-safe Observers
70
+ #### Thread-safe Structures
70
71
 
71
- * [Concurrent::Observable](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Observable.html) mixin module
72
- * [CopyOnNotifyObserverSet](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/CopyOnNotifyObserverSet.html)
73
- * [CopyOnWriteObserverSet](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/CopyOnWriteObserverSet.html)
72
+ Derived from Ruby's [Struct](http://ruby-doc.org/core-2.2.0/Struct.html):
74
73
 
75
- ### Thread synchronization classes and algorithms
74
+ * `ImmutableStruct` Immutable struct where values are set at construction and cannot be changed later.
75
+ * `MutableStruct` Synchronized, mutable struct where values can be safely changed at any time.
76
+ * `SettableStruct` Synchronized, write-once struct where values can be set at most once, either at construction or any time thereafter.
76
77
 
77
- Lower-level abstractions mainly used as building blocks.
78
+ #### Java-inspired ThreadPools and Other Executors
78
79
 
79
- * [condition](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Condition.html)
80
- * [countdown latch](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/CountDownLatch.html)
81
- * [cyclic barrier](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/CyclicBarrier.html)
82
- * [event](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Event.html)
83
- * [exchanger](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Exchanger.html)
84
- * [semaphore](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Semaphore.html)
85
- * [timeout](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent.html#timeout-class_method)
86
- * [timer](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent.html#timer-class_method)
80
+ * See [ThreadPool](http://ruby-concurrency.github.io/concurrent-ruby/file.thread_pools.html) overview, which also contains a list of other Executors available.
87
81
 
88
- ### Thread-safe variables
82
+ #### Thread Synchronization Classes and Algorithms
89
83
 
90
- Lower-level abstractions mainly used as building blocks.
84
+ * [CountdownLatch](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/CountDownLatch.html)
85
+ * [CyclicBarrier](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/CyclicBarrier.html)
86
+ * [Event](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Event.html)
87
+ * [Semaphore](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Semaphore.html)
88
+
89
+ #### Thread-safe Variables
91
90
 
92
91
  * [AtomicBoolean](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/AtomicBoolean.html)
93
92
  * [AtomicFixnum](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/AtomicFixnum.html)
94
- * AtomicReference (no docs currently available, check source)
93
+ * [AtomicReference](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/MutexAtomic.html)
95
94
  * [I-Structures](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/IVar.html) (IVar)
96
95
  * [M-Structures](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/MVar.html) (MVar)
97
- * [thread-local variables](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ThreadLocalVar.html)
98
- * [software transactional memory](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TVar.html) (TVar)
96
+ * [Thread-local variables](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ThreadLocalVar.html)
97
+ * [Software transactional memory](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TVar.html) (TVar)
98
+ * [ReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ReadWriteLock.html)
99
+
100
+ ### Edge Features
101
+
102
+ These are available in the `concurrent-ruby-edge` companion gem, installed with `gem install concurrent-ruby-edge`.
103
+
104
+ These features are under active development and may change frequently. They are expected not to
105
+ keep backward compatibility (there may also lack tests and documentation). Semantic versions will
106
+ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to move to `concurrent-ruby` when final.
107
+
108
+ * [Actor](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Actor.html):
109
+ Implements the Actor Model, where concurrent actors exchange messages.
110
+ * [new Future Framework](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge.html) - new
111
+ unified implementation of Futures and Promises which combines Features of previous `Future`,
112
+ `Promise`, `IVar`, `Event`, `Probe`, `dataflow`, `Delay`, `TimerTask` into single framework. It uses extensively
113
+ new synchronization layer to make all the paths **lock-free** with exception of blocking threads on `#wait`.
114
+ It offers better performance and does not block threads when not required.
115
+ * [Agent](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Agent.html): A single atomic value that represents an identity.
116
+ * [Channel](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Channel.html):
117
+ Communicating Sequential Processes (CSP).
118
+ * [Exchanger](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Exchanger.html)
119
+ * [LazyRegister](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/LazyRegister.html)
120
+ * [New Future Promise Framework](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge.html) - new
121
+ unified implementation of Futures and Promises which combines Features of previous `Future`,
122
+ `Promise`, `IVar`, `Probe`, `dataflow`, `Delay`, `TimerTask` into single framework. It uses extensively
123
+ new synchronization layer to make all the paths lock-free with exception of blocking threads on `#wait`.
124
+ It offers better performance and does not block threads (exception being `#wait` and similar methods where it's
125
+ intended).
126
+
127
+
128
+ #### Statuses:
129
+
130
+ *Why is not in core?*
131
+
132
+ - **Actor** - partial documentation and tests, stability good.
133
+ - **Future/Promise Framework** - partial documentation and tests, stability good.
134
+ - **Agent** - incomplete behaviour compared to Clojure's model, stability good.
135
+ - **Channel** - missing documentation, stability good.
136
+ - **Exchanger** - known race issue.
137
+ - **LazyRegister** - missing documentation and tests.
99
138
 
100
139
  ## Usage
101
140
 
@@ -112,29 +151,39 @@ require 'concurrent' # everything
112
151
 
113
152
  # groups
114
153
 
115
- require 'concurrent/actor' # Concurrent::Actor and supporting code
116
154
  require 'concurrent/atomics' # atomic and thread synchronization classes
117
- require 'concurrent/channels' # Concurrent::Channel and supporting code
118
155
  require 'concurrent/executors' # Thread pools and other executors
119
- require 'concurrent/utilities' # utility methods such as processor count and timers
120
156
 
121
157
  # individual abstractions
122
158
 
159
+ require 'concurrent/async' # Concurrent::Async
160
+ require 'concurrent/atom' # Concurrent::Atom
161
+ require 'concurrent/dataflow' # Concurrent::dataflow
162
+ require 'concurrent/delay' # Concurrent::Delay
163
+ require 'concurrent/future' # Concurrent::Future
164
+ require 'concurrent/immutable_struct' # Concurrent::ImmutableStruct
165
+ require 'concurrent/ivar' # Concurrent::IVar
166
+ require 'concurrent/maybe' # Concurrent::Maybe
167
+ require 'concurrent/mutable_struct' # Concurrent::MutableStruct
168
+ require 'concurrent/mvar' # Concurrent::MVar
169
+ require 'concurrent/promise' # Concurrent::Promise
170
+ require 'concurrent/scheduled_task' # Concurrent::ScheduledTask
171
+ require 'concurrent/settable_struct' # Concurrent::SettableStruct
172
+ require 'concurrent/timer_task' # Concurrent::TimerTask
173
+ require 'concurrent/tvar' # Concurrent::TVar
174
+
175
+ # experimental - available in `concurrent-ruby-edge` companion gem
176
+
177
+ require 'concurrent/actor' # Concurrent::Actor and supporting code
178
+ require 'concurrent/edge/future' # new Future Framework
123
179
  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
180
+ require 'concurrent/channel ' # Concurrent::Channel and supporting code
128
181
  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
182
+ require 'concurrent/lazy_register' # Concurrent::LazyRegister
136
183
  ```
137
184
 
185
+ If the library does not behave as expected, `Concurrent.use_stdlib_logger(Logger::DEBUG)` could help to reveal the problem.
186
+
138
187
  ## Installation
139
188
 
140
189
  ```shell
@@ -153,8 +202,8 @@ and run `bundle install` from your shell.
153
202
 
154
203
  Potential performance improvements may be achieved under MRI by installing optional C extensions.
155
204
  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:
205
+ gem. `concurrent-ruby` and `concurrent-ruby-ext` are always released together with same version.
206
+ Simply install the extension gem too:
158
207
 
159
208
  ```ruby
160
209
  gem install concurrent-ruby-ext
@@ -191,22 +240,22 @@ any platform. *Documentation is forthcoming...*
191
240
 
192
241
  ```
193
242
  *MRI only*
194
- rake build:native # Build concurrent-ruby-ext-<version>-<platform>.gem into the pkg directory
195
- rake compile:extension # Compile extension
243
+ bundle exec rake build:native # Build concurrent-ruby-ext-<version>-<platform>.gem into the pkg dir
244
+ bundle exec rake compile:extension # Compile extension
196
245
 
197
246
  *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
247
+ bundle exec rake build # Build JRuby-specific core gem (alias for `build:core`)
248
+ bundle exec rake build:core # Build concurrent-ruby-<version>-java.gem into the pkg directory
200
249
 
201
250
  *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
251
+ bundle exec rake build # Build core and extension gems
252
+ bundle exec rake build:core # Build concurrent-ruby-<version>.gem into the pkg directory
253
+ bundle exec rake build:ext # Build concurrent-ruby-ext-<version>.gem into the pkg directory
205
254
 
206
255
  *All*
207
- rake clean # Remove any temporary products
208
- rake clobber # Remove any generated file
209
- rake compile # Compile all the extensions
256
+ bundle exec rake clean # Remove any temporary products
257
+ bundle exec rake clobber # Remove any generated file
258
+ bundle exec rake compile # Compile all the extensions
210
259
  ```
211
260
 
212
261
  ## Maintainers
@@ -218,7 +267,7 @@ rake compile # Compile all the extensions
218
267
  * [Petr Chalupa](https://github.com/pitr-ch)
219
268
  * [Paweł Obrok](https://github.com/obrok)
220
269
 
221
- ### Contributing
270
+ ## Contributing
222
271
 
223
272
  1. Fork it
224
273
  2. Create your feature branch (`git checkout -b my-new-feature`)
@@ -50,9 +50,13 @@ VALUE ir_set(VALUE self, VALUE new_value) {
50
50
  }
51
51
 
52
52
  VALUE ir_get_and_set(VALUE self, VALUE new_value) {
53
- VALUE old_value = ir_get(self);
54
- ir_set(self, new_value);
55
- return old_value;
53
+ VALUE old_value;
54
+ for (;;) {
55
+ old_value = ir_get(self);
56
+ if (ir_compare_and_set(self, old_value, new_value) == Qtrue) {
57
+ return old_value;
58
+ }
59
+ }
56
60
  }
57
61
 
58
62
  VALUE ir_compare_and_set(volatile VALUE self, VALUE expect_value, VALUE new_value) {
@@ -1,6 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
- require_relative '../../lib/extension_helper'
3
+ require 'concurrent/utility/native_extension_loader'
4
4
 
5
5
  EXTENSION_NAME = 'extension'
6
6
 
@@ -11,7 +11,7 @@ def create_dummy_makefile
11
11
  end
12
12
  end
13
13
 
14
- if defined?(JRUBY_VERSION) || ! Concurrent.allow_c_extensions?
14
+ if Concurrent.on_jruby? || ! Concurrent.allow_c_extensions?
15
15
  create_dummy_makefile
16
16
  warn 'C optimizations are not supported on this version of Ruby.'
17
17
  else
@@ -7,7 +7,7 @@
7
7
  // module and class definitions
8
8
 
9
9
  static VALUE rb_mConcurrent;
10
- static VALUE rb_cAtomic;
10
+ static VALUE rb_cAtomicReference;
11
11
  static VALUE rb_cAtomicBoolean;
12
12
  static VALUE rb_cAtomicFixnum;
13
13
 
@@ -17,20 +17,20 @@ void Init_extension() {
17
17
 
18
18
  // define modules and classes
19
19
  rb_mConcurrent = rb_define_module("Concurrent");
20
- rb_cAtomic = rb_define_class_under(rb_mConcurrent, "CAtomic", rb_cObject);
20
+ rb_cAtomicReference = rb_define_class_under(rb_mConcurrent, "CAtomicReference", rb_cObject);
21
21
  rb_cAtomicBoolean = rb_define_class_under(rb_mConcurrent, "CAtomicBoolean", rb_cObject);
22
22
  rb_cAtomicFixnum = rb_define_class_under(rb_mConcurrent, "CAtomicFixnum", rb_cObject);
23
23
 
24
- // CAtomic
25
- rb_define_alloc_func(rb_cAtomic, ir_alloc);
26
- rb_define_method(rb_cAtomic, "initialize", ir_initialize, -1);
27
- rb_define_method(rb_cAtomic, "get", ir_get, 0);
28
- rb_define_method(rb_cAtomic, "set", ir_set, 1);
29
- rb_define_method(rb_cAtomic, "get_and_set", ir_get_and_set, 1);
30
- rb_define_method(rb_cAtomic, "_compare_and_set", ir_compare_and_set, 2);
31
- rb_define_alias(rb_cAtomic, "value", "get");
32
- rb_define_alias(rb_cAtomic, "value=", "set");
33
- rb_define_alias(rb_cAtomic, "swap", "get_and_set");
24
+ // CAtomicReference
25
+ rb_define_alloc_func(rb_cAtomicReference, ir_alloc);
26
+ rb_define_method(rb_cAtomicReference, "initialize", ir_initialize, -1);
27
+ rb_define_method(rb_cAtomicReference, "get", ir_get, 0);
28
+ rb_define_method(rb_cAtomicReference, "set", ir_set, 1);
29
+ rb_define_method(rb_cAtomicReference, "get_and_set", ir_get_and_set, 1);
30
+ rb_define_method(rb_cAtomicReference, "_compare_and_set", ir_compare_and_set, 2);
31
+ rb_define_alias(rb_cAtomicReference, "value", "get");
32
+ rb_define_alias(rb_cAtomicReference, "value=", "set");
33
+ rb_define_alias(rb_cAtomicReference, "swap", "get_and_set");
34
34
 
35
35
  // CAtomicBoolean
36
36
  rb_define_alloc_func(rb_cAtomicBoolean, atomic_boolean_allocate);
@@ -3,6 +3,9 @@ require 'concurrent/atomic_reference/concurrent_update_error'
3
3
  module Concurrent
4
4
 
5
5
  # Define update methods that use direct paths
6
+ #
7
+ # @!visibility private
8
+ # @!macro internal_implementation_note
6
9
  module AtomicDirectUpdate
7
10
 
8
11
  # @!macro [attach] atomic_reference_method_update
@@ -1,6 +1,9 @@
1
1
  module Concurrent
2
2
 
3
3
  # Special "compare and set" handling of numeric values.
4
+ #
5
+ # @!visibility private
6
+ # @!macro internal_implementation_note
4
7
  module AtomicNumericCompareAndSetWrapper
5
8
 
6
9
  # @!macro atomic_reference_method_compare_and_set
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry D'Antonio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-25 00:00:00.000000000 Z
11
+ date: 2015-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.0
19
+ version: 0.9.0.pre2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.8.0
26
+ version: 0.9.0.pre2
27
27
  description: |2
28
28
  C extensions to optimize the concurrent-ruby gem when running under MRI.
29
29
  Please see http://concurrent-ruby.com for more information.
@@ -51,7 +51,6 @@ files:
51
51
  - lib/concurrent/atomic_reference/concurrent_update_error.rb
52
52
  - lib/concurrent/atomic_reference/direct_update.rb
53
53
  - lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
54
- - lib/extension_helper.rb
55
54
  homepage: http://www.concurrent-ruby.com
56
55
  licenses:
57
56
  - MIT
@@ -68,13 +67,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
67
  version: 1.9.3
69
68
  required_rubygems_version: !ruby/object:Gem::Requirement
70
69
  requirements:
71
- - - ">="
70
+ - - ">"
72
71
  - !ruby/object:Gem::Version
73
- version: '0'
72
+ version: 1.3.1
74
73
  requirements: []
75
74
  rubyforge_project:
76
- rubygems_version: 2.4.5
75
+ rubygems_version: 2.4.7
77
76
  signing_key:
78
77
  specification_version: 4
79
78
  summary: C extensions to optimize concurrent-ruby under MRI.
80
79
  test_files: []
80
+ has_rdoc:
@@ -1,37 +0,0 @@
1
- module Concurrent
2
-
3
- @@c_ext_loaded ||= false
4
- @@java_ext_loaded ||= false
5
-
6
- # @!visibility private
7
- def self.allow_c_extensions?
8
- defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
9
- end
10
-
11
- # @!visibility private
12
- def self.jruby?
13
- RUBY_PLATFORM == 'java'
14
- end
15
-
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
36
- end
37
- end