concurrent-ruby-ext 0.9.0.pre2 → 0.9.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: 5db5d3a4081b567da10c4e3b65fdf3a1419ca3bf
4
- data.tar.gz: 432dfbcabb9af5a98edc844d32482396db63a8dd
3
+ metadata.gz: 672ece2d47f9447499ad9ccdb237f48c97d5f78f
4
+ data.tar.gz: 69d8d5e03e37578d1844238cdbf0ff66c6b3e28e
5
5
  SHA512:
6
- metadata.gz: d8597be5e0f0a1d17033f5562e29557106f566848b7b3e38cd9e537b036e5217f6eaeca0bc4a3e0eb6e03dda2acfddee7aeb70eef17068c7a563582c5c2b07a6
7
- data.tar.gz: aa08718809471ddeb1510e3afb1c8cb1e5bae59d1117cf3e068cc70bdae2b968beb9176a86cb040abff8f3eee8fa661bc147b4e02a2c563ee41f190ccaff399d
6
+ metadata.gz: f0c74f2a9ee6f4847fe14029ff176bede2fb5c5bf72740259ebf3c758cb111927d4e8c464571b08097c9d9d29280ff79081dd04b5f6bf73333ff6850a44ded66
7
+ data.tar.gz: cb397665290f54f5cb256be0f0f531ca51fefe2ceff14dfa6cdd29a51bcd5a5119014fe3a3e8d8f8a004c77d2d8fb13ec4a403b4194ead9569ff9f333c5ceb3f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ### Next Release v0.9.0 (Target Date: 7 June 2015)
2
2
 
3
+
4
+ * Updated `AtomicReference`
5
+ - `AtomicReference#try_update` now simply returns instead of raising exception
6
+ - `AtomicReference#try_update!` was added to raise exceptions if an update
7
+ fails. Note: this is the same behavior as the old `try_update`
3
8
  * Pure Java implementations of
4
9
  - `AtomicBoolean`
5
10
  - `AtomicFixnum`
@@ -58,7 +63,7 @@
58
63
  - `Channel`
59
64
  - `Exchanger`
60
65
  - `LazyRegister`
61
- - **new Future Framework** <http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge.html> - unified
66
+ - **new Future Framework** <http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge.html> - unified
62
67
  implementation of Futures and Promises which combines Features of previous `Future`,
63
68
  `Promise`, `IVar`, `Event`, `Probe`, `dataflow`, `Delay`, `TimerTask` into single framework. It uses extensively
64
69
  new synchronization layer to make all the paths **lock-free** with exception of blocking threads on `#wait`.
@@ -80,7 +85,7 @@
80
85
  - Add AbstractContext#default_executor to be able to override executor class wide
81
86
  - Add basic IO example
82
87
  - Documentation somewhat improved
83
- - All messages should have same priority. It's now possible to send `actor << job1 << job2 << :terminate!` and
88
+ - All messages should have same priority. It's now possible to send `actor << job1 << job2 << :terminate!` and
84
89
  be sure that both jobs are processed first.
85
90
  * Refactored `Channel` to use newer synchronization objects
86
91
  * Added `#reset` and `#cancel` methods to `TimerSet`
@@ -162,7 +167,7 @@ Please see the [roadmap](https://github.com/ruby-concurrency/concurrent-ruby/iss
162
167
  - `SerializedExecutionDelegator` for serializing *any* executor
163
168
  * Updated `Async` with serialized execution
164
169
  * Updated `ImmediateExecutor` and `PerThreadExecutor` with full executor service lifecycle
165
- * Added a `Delay` to root `Actress` initialization
170
+ * Added a `Delay` to root `Actress` initialization
166
171
  * Minor bug fixes to thread pools
167
172
  * Refactored many intermittently failing specs
168
173
  * Removed Java interop warning `executor.rb:148 warning: ambiguous Java methods found, using submit(java.lang.Runnable)`
@@ -1,5 +1,6 @@
1
1
  require 'fileutils'
2
2
 
3
+ $:.unshift(File.expand_path('../../../lib', __FILE__))
3
4
  require 'concurrent/utility/native_extension_loader'
4
5
 
5
6
  EXTENSION_NAME = 'extension'
@@ -13,7 +13,7 @@ module Concurrent
13
13
  # Pass the current value to the given block, replacing it
14
14
  # with the block's result. May retry if the value changes
15
15
  # during the block's execution.
16
- #
16
+ #
17
17
  # @yield [Object] Calculate a new value for the atomic reference using
18
18
  # given (old) value
19
19
  # @yieldparam [Object] old_value the starting value of the atomic reference
@@ -27,17 +27,45 @@ module Concurrent
27
27
  # @!macro [attach] atomic_reference_method_try_update
28
28
  #
29
29
  # Pass the current value to the given block, replacing it
30
+ # with the block's result. Return nil if the update fails.
31
+ #
32
+ # @yield [Object] Calculate a new value for the atomic reference using
33
+ # given (old) value
34
+ # @yieldparam [Object] old_value the starting value of the atomic reference
35
+ #
36
+ # @note This method was altered to avoid raising an exception by default.
37
+ # Instead, this method now returns `nil` in case of failure. For more info,
38
+ # please see: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
39
+ #
40
+ # @return [Object] the new value, or nil if update failed
41
+ def try_update
42
+ old_value = get
43
+ new_value = yield old_value
44
+
45
+ return unless compare_and_set old_value, new_value
46
+
47
+ new_value
48
+ end
49
+
50
+ # @!macro [attach] atomic_reference_method_try_update!
51
+ #
52
+ # Pass the current value to the given block, replacing it
30
53
  # with the block's result. Raise an exception if the update
31
54
  # fails.
32
- #
55
+ #
33
56
  # @yield [Object] Calculate a new value for the atomic reference using
34
57
  # given (old) value
35
58
  # @yieldparam [Object] old_value the starting value of the atomic reference
36
59
  #
60
+ # @note This behavior mimics the behavior of the original
61
+ # `AtomicReference#try_update` API. The reason this was changed was to
62
+ # avoid raising exceptions (which are inherently slow) by default. For more
63
+ # info: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
64
+ #
37
65
  # @return [Object] the new value
38
66
  #
39
67
  # @raise [Concurrent::ConcurrentUpdateError] if the update fails
40
- def try_update
68
+ def try_update!
41
69
  old_value = get
42
70
  new_value = yield old_value
43
71
  unless compare_and_set(old_value, new_value)
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.9.0.pre2
4
+ version: 0.9.0.pre3
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-06-08 00:00:00.000000000 Z
11
+ date: 2015-06-22 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.9.0.pre2
19
+ version: 0.9.0.pre3
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.9.0.pre2
26
+ version: 0.9.0.pre3
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.
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: 1.3.1
73
73
  requirements: []
74
74
  rubyforge_project:
75
- rubygems_version: 2.4.7
75
+ rubygems_version: 2.4.8
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: C extensions to optimize concurrent-ruby under MRI.