concurrent-ruby 1.0.0.pre2 → 1.0.0.pre3

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: 0148d111f8cfb5ce264c12f5a0cef91ca1bf36e3
4
- data.tar.gz: 6d773f8549a2a1f989c5135d49e0a91ed51f04d6
3
+ metadata.gz: 0dc607165069d68d20f3cdc11dc2fda36987a341
4
+ data.tar.gz: 7e6c28de16b282bb4339ab3e07a786f3c468c8b4
5
5
  SHA512:
6
- metadata.gz: 2bbee143971798fd8ea52f03fb361a9b5ce8fe3db4d5c8eecb45ee21b9ad29939dc458a9f20320496cc70f6fae22fe799d0b3d179e280b19180b28d9ba891d12
7
- data.tar.gz: 45c8e415754d1148b839d28da1d386be611ba598b560d1c8e7acd7e7eb000621f0400b1901d94a1a10036836119f67c92b70a73484ae827adaecda74a496e108
6
+ metadata.gz: 5af93689cc08e9415e23aba1bda309226bbdff2a1b99f30ffd4e879f1e6190d86aba2b1be9b83b1681717e63f8e6d9c2fb53e4e542260f3e855ee12b6a74770e
7
+ data.tar.gz: 84030bd44e276836f3f329bace8489181de2c87c7aa311acd460bf714958ffe755dd555ba8aea0d8ecd621098f07b9f3dde6774913100d10e1998e26aa0d9f6f
@@ -1,4 +1,15 @@
1
- ## Current Release v1.0.0.pre2 (19 September 2015)
1
+ ### Upcoming Release v1.0.0 (TBD)
2
+
3
+ ## Current Release v1.0.0.pre3 (29 September 2015)
4
+
5
+ * Removed interpreter warnings.
6
+ * Shared constants now in `lib/concurrent/constants.rb`
7
+ * Refactored many tests.
8
+ * Improved synchronization layer/memory model documentation.
9
+ * Bug fix in Edge `Future#flat`
10
+ * Brand new `Channel` implementation in Edge gem.
11
+
12
+ ### Release v1.0.0.pre2 (19 September 2015)
2
13
 
3
14
  * Simplification of `RubySingleThreadExecutor`
4
15
  * `Async` improvements
@@ -10,8 +21,9 @@
10
21
  - Now `Observable`
11
22
  - Added a `#reset` method
12
23
  * Brand new `Agent` API and implementation. Now functionally equivalent to Clojure.
24
+ * Continued improvements to the synchronization layer
13
25
 
14
- ### Current Release v1.0.0.pre1 (19 August 2015)
26
+ ### Release v1.0.0.pre1 (19 August 2015)
15
27
 
16
28
  * Merged in the `thread_safe` gem
17
29
  - `Concurrent::Array`
data/README.md CHANGED
@@ -130,8 +130,10 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
130
130
  `Promise`, `IVar`, `Event`, `dataflow`, `Delay`, and `TimerTask` into a single framework. It extensively uses the
131
131
  new synchronization layer to make all the features **non-blocking** and **lock-free**, with the exception of obviously blocking
132
132
  operations like `#wait`, `#value`. It also offers better performance.
133
- * [Channel](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Channel.html):
134
- Communicating Sequential Processes (CSP).
133
+ * [Channel](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/Channel.html):
134
+ Communicating Sequential Processes ([CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes)).
135
+ Functionally equivalent to Go [channels](https://tour.golang.org/concurrency/2) with additional
136
+ inspiration from Clojure [core.async](https://clojure.github.io/core.async/).
135
137
  * [LazyRegister](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/LazyRegister.html)
136
138
  * [AtomicMarkableReference](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/AtomicMarkableReference.html)
137
139
  * [LockFreeLinkedSet](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/LockFreeLinkedSet.html)
@@ -142,10 +144,10 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
142
144
  *Why are these not in core?*
143
145
 
144
146
  - **Actor** - Partial documentation and tests; depends on new future/promise framework; stability is good.
145
- - **Future/Promise Framework** - API changes; partial documentation and tests; stability good.
146
- - **Channel** - Missing documentation; limited features; stability good.
147
+ - **Channel** - Brand new implementation; partial documentation and tests; stability is good.
148
+ - **Future/Promise Framework** - API changes; partial documentation and tests; stability is good.
147
149
  - **LazyRegister** - Missing documentation and tests.
148
- - **AtomicMarkableReference, LockFreeLinkedSet, LockFreeStack** - Need real world battle testing
150
+ - **AtomicMarkableReference, LockFreeLinkedSet, LockFreeStack** - Need real world battle testing.
149
151
 
150
152
  ## Usage
151
153
 
@@ -1,8 +1,9 @@
1
1
  require 'concurrent/version'
2
+ require 'concurrent/constants'
3
+ require 'concurrent/errors'
2
4
  require 'concurrent/configuration'
3
5
 
4
6
  require 'concurrent/atomics'
5
- require 'concurrent/errors'
6
7
  require 'concurrent/executors'
7
8
  require 'concurrent/synchronization'
8
9
 
@@ -126,9 +127,4 @@ require 'concurrent/options'
126
127
  # * Be small, lean, and loosely coupled
127
128
  module Concurrent
128
129
 
129
- # Various classes within allows for +nil+ values to be stored,
130
- # so a special +NULL+ token is required to indicate the "nil-ness".
131
- # @!visibility private
132
- NULL = Object.new
133
-
134
130
  end
@@ -3,6 +3,40 @@ require 'concurrent/collection/copy_on_notify_observer_set'
3
3
  require 'concurrent/concern/observable'
4
4
  require 'concurrent/synchronization'
5
5
 
6
+ # @!macro [new] thread_safe_variable_comparison
7
+ #
8
+ # ## Thread-safe Variable Classes
9
+ #
10
+ # Each of the thread-safe variable classes is designed to solve a different
11
+ # problem. In general:
12
+ #
13
+ # * *{Concurrent::Agent}:* Shared, mutable variable providing independent,
14
+ # uncoordinated, *asynchronous* change of individual values. Best used when
15
+ # the value will undergo frequent, complex updates. Suitable when the result
16
+ # of an update does not need to be known immediately.
17
+ # * *{Concurrent::Atom}:* Shared, mutable variable providing independent,
18
+ # uncoordinated, *synchronous* change of individual values. Best used when
19
+ # the value will undergo frequent reads but only occasional, though complex,
20
+ # updates. Suitable when the result of an update must be known immediately.
21
+ # * *{Concurrent::AtomicReference}:* A simple object reference that can be
22
+ # atomically. Updates are synchronous but fast. Bast used when updates a
23
+ # simple set operations. Not suitable when updates are complex.
24
+ # {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar
25
+ # but optimized for the given data type.
26
+ # * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used
27
+ # when two or more threads need to exchange data. The threads will pair then
28
+ # block on each other until the exchange is complete.
29
+ # * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread
30
+ # must give a value to another, which must take the value. The threads will
31
+ # block on each other until the exchange is complete.
32
+ # * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which
33
+ # holds a different value for each thread which has access. Often used as
34
+ # an instance variable in objects which must maintain different state
35
+ # for different threads.
36
+ # * *{Concurrent::TVar}:* Shared, mutable variables which provide
37
+ # *coordinated*, *synchronous*, change of *many* stated. Used when multiple
38
+ # value must change together, in an all-or-nothing transaction.
39
+
6
40
  module Concurrent
7
41
 
8
42
  # Atoms provide a way to manage shared, synchronous, independent state.
@@ -61,7 +95,7 @@ module Concurrent
61
95
  include Concern::Observable
62
96
 
63
97
  safe_initialization!
64
- private *attr_volatile_with_cas(:value)
98
+ private(*attr_volatile_with_cas(:value))
65
99
  public :value
66
100
 
67
101
  # Create a new atom with the given initial value.
@@ -1,3 +1,5 @@
1
+ require 'concurrent/constants'
2
+
1
3
  module Concurrent
2
4
 
3
5
  # @!macro thread_local_var
@@ -5,10 +7,6 @@ module Concurrent
5
7
  # @!visibility private
6
8
  class AbstractThreadLocalVar
7
9
 
8
- # @!visibility private
9
- NIL_SENTINEL = Object.new
10
- private_constant :NIL_SENTINEL
11
-
12
10
  # @!macro thread_local_var_method_initialize
13
11
  def initialize(default = nil)
14
12
  @default = default
@@ -14,7 +14,7 @@ if Concurrent.on_jruby?
14
14
 
15
15
  if value.nil?
16
16
  @default
17
- elsif value == NIL_SENTINEL
17
+ elsif value == NULL
18
18
  nil
19
19
  else
20
20
  value
@@ -51,7 +51,7 @@ module Concurrent
51
51
  value = array[@index]
52
52
  if value.nil?
53
53
  @default
54
- elsif value.equal?(NIL_SENTINEL)
54
+ elsif value.equal?(NULL)
55
55
  nil
56
56
  else
57
57
  value
@@ -72,7 +72,7 @@ module Concurrent
72
72
  LOCK.synchronize { ARRAYS[array.object_id] = array }
73
73
  ObjectSpace.define_finalizer(me, self.class.thread_finalizer(array))
74
74
  end
75
- array[@index] = (value.nil? ? NIL_SENTINEL : value)
75
+ array[@index] = (value.nil? ? NULL : value)
76
76
  value
77
77
  end
78
78
 
@@ -159,7 +159,7 @@ module Concurrent
159
159
  value = array[@index]
160
160
  if value.nil?
161
161
  @default
162
- elsif value.equal?(NIL_SENTINEL)
162
+ elsif value.equal?(NULL)
163
163
  nil
164
164
  else
165
165
  value
@@ -1,3 +1,4 @@
1
+ require 'concurrent/constants'
1
2
  require 'concurrent/thread_safe/util'
2
3
  require 'concurrent/thread_safe/util/adder'
3
4
  require 'concurrent/thread_safe/util/cheap_lockable'
@@ -1,3 +1,5 @@
1
+ require 'concurrent/constants'
2
+
1
3
  module Concurrent
2
4
 
3
5
  # @!visibility private
@@ -0,0 +1,8 @@
1
+ module Concurrent
2
+
3
+ # Various classes within allows for +nil+ values to be stored,
4
+ # so a special +NULL+ token is required to indicate the "nil-ness".
5
+ # @!visibility private
6
+ NULL = Object.new
7
+
8
+ end
@@ -1,3 +1,4 @@
1
+ require 'concurrent/constants'
1
2
  require 'concurrent/errors'
2
3
  require 'concurrent/maybe'
3
4
  require 'concurrent/atomic/atomic_reference'
@@ -139,10 +140,6 @@ module Concurrent
139
140
  # not include the arena or the multi-processor spin loops.
140
141
  # http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/concurrent/Exchanger.java
141
142
 
142
- # @!visibility private
143
- NIL_SENTINEL = Object.new
144
- private_constant :NIL_SENTINEL
145
-
146
143
  # @!visibility private
147
144
  class Node < Concurrent::AtomicReference
148
145
  attr_reader :item, :latch
@@ -249,7 +246,7 @@ module Concurrent
249
246
  # - Wake the sleeping occupier
250
247
  # - Return the occupier's item
251
248
 
252
- value = NIL_SENTINEL if value.nil? # The sentinel allows nil to be a valid value
249
+ value = NULL if value.nil? # The sentinel allows nil to be a valid value
253
250
  slot = @slot # Convenience to minimize typing @
254
251
  me = Node.new(value) # create my node in case I need to occupy
255
252
  end_at = Concurrent.monotonic_time + timeout.to_f # The time to give up
@@ -282,7 +279,7 @@ module Concurrent
282
279
  break CANCEL if timeout && Concurrent.monotonic_time >= end_at
283
280
  end
284
281
 
285
- result == NIL_SENTINEL ? nil : result
282
+ result == NULL ? nil : result
286
283
  end
287
284
  end
288
285
 
@@ -1,4 +1,5 @@
1
1
  require 'thread'
2
+ require 'concurrent/constants'
2
3
  require 'concurrent/errors'
3
4
  require 'concurrent/ivar'
4
5
  require 'concurrent/executor/safe_task_executor'
@@ -1,3 +1,4 @@
1
+ require 'concurrent/constants'
1
2
  require 'concurrent/errors'
2
3
  require 'concurrent/collection/copy_on_write_observer_set'
3
4
  require 'concurrent/concern/obligation'
@@ -1,4 +1,5 @@
1
1
  require 'thread'
2
+ require 'concurrent/constants'
2
3
 
3
4
  module Concurrent
4
5
  # @!visibility private
@@ -1,4 +1,5 @@
1
1
  require 'thread'
2
+ require 'concurrent/constants'
2
3
  require 'concurrent/errors'
3
4
  require 'concurrent/ivar'
4
5
 
@@ -1,3 +1,4 @@
1
+ require 'concurrent/constants'
1
2
  require 'concurrent/errors'
2
3
  require 'concurrent/configuration'
3
4
  require 'concurrent/ivar'
@@ -1,6 +1,8 @@
1
1
  require 'concurrent/utility/engine'
2
2
 
3
3
  require 'concurrent/synchronization/abstract_object'
4
+ require 'concurrent/utility/native_extension_loader' # load native parts first
5
+
4
6
  require 'concurrent/synchronization/mri_object'
5
7
  require 'concurrent/synchronization/jruby_object'
6
8
  require 'concurrent/synchronization/rbx_object'
@@ -11,7 +13,6 @@ require 'concurrent/synchronization/mri_lockable_object'
11
13
  require 'concurrent/synchronization/jruby_lockable_object'
12
14
  require 'concurrent/synchronization/rbx_lockable_object'
13
15
 
14
- require 'concurrent/utility/native_extension_loader' # load native part first
15
16
  require 'concurrent/synchronization/lockable_object'
16
17
 
17
18
  require 'concurrent/synchronization/condition'
@@ -79,7 +79,7 @@ module Concurrent
79
79
  end
80
80
 
81
81
  def self.safe_initialization?
82
- @safe_initialization || (superclass.respond_to?(:safe_initialization?) && superclass.safe_initialization?)
82
+ (defined?(@safe_initialization) && @safe_initialization) || (superclass.respond_to?(:safe_initialization?) && superclass.safe_initialization?)
83
83
  end
84
84
 
85
85
  # For testing purposes, quite slow.
@@ -122,7 +122,7 @@ module Concurrent
122
122
  end
123
123
 
124
124
  def update_#{name}(&block)
125
- #{ivar}.update &block
125
+ #{ivar}.update(&block)
126
126
  end
127
127
  RUBY
128
128
  end
@@ -1,39 +1,5 @@
1
1
  require 'set'
2
2
 
3
- # @!macro [new] thread_safe_variable_comparison
4
- #
5
- # ## Thread-safe Variable Classes
6
- #
7
- # Each of the thread-safe variable classes is designed to solve a different
8
- # problem. In general:
9
- #
10
- # * *{Concurrent::Agent}:* Shared, mutable variable providing independent,
11
- # uncoordinated, *asynchronous* change of individual values. Best used when
12
- # the value will undergo frequent, complex updates. Suitable when the result
13
- # of an update does not need to be known immediately.
14
- # * *{Concurrent::Atom}:* Shared, mutable variable providing independent,
15
- # uncoordinated, *synchronous* change of individual values. Best used when
16
- # the value will undergo frequent reads but only occasional, though complex,
17
- # updates. Suitable when the result of an update must be known immediately.
18
- # * *{Concurrent::AtomicReference}:* A simple object reference that can be
19
- # atomically. Updates are synchronous but fast. Bast used when updates a
20
- # simple set operations. Not suitable when updates are complex.
21
- # {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar
22
- # but optimized for the given data type.
23
- # * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used
24
- # when two or more threads need to exchange data. The threads will pair then
25
- # block on each other until the exchange is complete.
26
- # * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread
27
- # must give a value to another, which must take the value. The threads will
28
- # block on each other until the exchange is complete.
29
- # * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which
30
- # holds a different value for each thread which has access. Often used as
31
- # an instance variable in objects which must maintain different state
32
- # for different threads.
33
- # * *{Concurrent::TVar}:* Shared, mutable variables which provide
34
- # *coordinated*, *synchronous*, change of *many* stated. Used when multiple
35
- # value must change together, in an all-or-nothing transaction.
36
-
37
3
  module Concurrent
38
4
 
39
5
  # A `TVar` is a transactional variable - a single-element container that
@@ -1,4 +1,4 @@
1
- require 'concurrent/synchronization' # has to be loaded before JRuby extensions
1
+ require 'concurrent/synchronization/abstract_object' # must be loaded before JRuby extensions
2
2
  require 'concurrent/utility/engine'
3
3
 
4
4
  module Concurrent
@@ -1,4 +1,4 @@
1
1
  module Concurrent
2
- VERSION = '1.0.0.pre2'
3
- EDGE_VERSION = '0.2.0.pre2'
2
+ VERSION = '1.0.0.pre3'
3
+ EDGE_VERSION = '0.2.0.pre3'
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: 1.0.0.pre2
4
+ version: 1.0.0.pre3
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-09-19 00:00:00.000000000 Z
12
+ date: 2015-09-29 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.
@@ -73,6 +73,7 @@ files:
73
73
  - lib/concurrent/concern/obligation.rb
74
74
  - lib/concurrent/concern/observable.rb
75
75
  - lib/concurrent/configuration.rb
76
+ - lib/concurrent/constants.rb
76
77
  - lib/concurrent/dataflow.rb
77
78
  - lib/concurrent/delay.rb
78
79
  - lib/concurrent/edge.rb
@@ -164,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  version: 1.3.1
165
166
  requirements: []
166
167
  rubyforge_project:
167
- rubygems_version: 2.4.5.1
168
+ rubygems_version: 2.4.8
168
169
  signing_key:
169
170
  specification_version: 4
170
171
  summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell,