concurrent-ruby-ext 0.9.0 → 0.9.1

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: a9481013a26cd32bc9c7a41efc7fe7a797343fef
4
- data.tar.gz: b145937e4567f1e0989901496d78ba60c151c2ec
3
+ metadata.gz: 5c0e7c39cd01710d92b2bad09c1a997cc0c7b268
4
+ data.tar.gz: 4f115c799b21eb013c0fe186f07617521fca395a
5
5
  SHA512:
6
- metadata.gz: 9b1551a0fadd98afd5095cf0a3fc5320b5705dafe8015b17b56116234e866e432c919768ca433ebe5899f857dd28b7e6816fd618a540ebdcd92a119f83d46c47
7
- data.tar.gz: 11303e8a0c5b3ca961d69ba585b855c8e05a8960fcc50a2a7072d50222d9288a491862d1fbfab0f1252309114f88c2df455b6f2118fcdaccf91d97ef4a57ad0b
6
+ metadata.gz: a9d4e8dc5af18a7f94379d3c015c2539ee0b85dcee2152b9d1c71a3c166cb712c9cf3cbf36092d83edb6594e3bb37081a9591ef2e097034e9d33689d7a9f1825
7
+ data.tar.gz: a41bef388f006afcb948f2172ac8d20bbc76ff7581f6939e22924b6b8f41537e9fb483d767eca53906f944af2016379da7e506a4462e452e55140f46886229e1
data/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
- ## Current Release v0.9.0 (10 July 2015)
1
+ ## Current Release v0.9.1 (09 August 2015)
2
+
3
+ * Fixed a Rubiniux bug in synchronization object
4
+ * Fixed all interpreter warnings (except circular references)
5
+ * Fixed require statements when requiring `Atom` alone
6
+ * Significantly improved `ThreadLocalVar` on non-JRuby platforms
7
+ * Fixed error handling in Edge `Concurrent.zip`
8
+ * `AtomicFixnum` methods `#increment` and `#decrement` now support optional delta
9
+ * New `AtomicFixnum#update` method
10
+ * Minor optimizations in `ReadWriteLock`
11
+ * New `ReentrantReadWriteLock` class
12
+ * `ThreadLocalVar#bind` method is now public
13
+ * Refactored many tests
14
+
15
+ ### Release v0.9.0 (10 July 2015)
2
16
 
3
17
  * Updated `AtomicReference`
4
18
  - `AtomicReference#try_update` now simply returns instead of raising exception
data/README.md CHANGED
@@ -1,5 +1,13 @@
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) [![Build status](https://ci.appveyor.com/api/projects/status/iq8aboyuu3etad4w?svg=true)](https://ci.appveyor.com/project/rubyconcurrency/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
+
3
+ [![Gem Version](https://badge.fury.io/rb/concurrent-ruby.svg)](http://badge.fury.io/rb/concurrent-ruby)
4
+ [![Build Status](https://travis-ci.org/ruby-concurrency/concurrent-ruby.svg?branch=master)](https://travis-ci.org/ruby-concurrency/concurrent-ruby)
5
+ [![Build status](https://ci.appveyor.com/api/projects/status/iq8aboyuu3etad4w?svg=true)](https://ci.appveyor.com/project/rubyconcurrency/concurrent-ruby)
6
+ [![Code Climate](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby.svg)](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby)
7
+ [![Inline docs](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby.svg)](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby)
8
+ [![Dependency Status](https://gemnasium.com/ruby-concurrency/concurrent-ruby.svg)](https://gemnasium.com/ruby-concurrency/concurrent-ruby)
9
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
10
+ [![Gitter chat](https://img.shields.io/badge/IRC%20(gitter)-devs%20%26%20users-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)
3
11
 
4
12
  <table>
5
13
  <tr>
@@ -43,13 +51,13 @@ Java 8 is required for JRuby (Java 7 support is deprecated in version 0.9 and wi
43
51
 
44
52
  ## Features & Documentation
45
53
 
46
- We have a roadmap guiding our work toward the [v1.0.0 release](https://github.com/ruby-concurrency/concurrent-ruby/wiki/v1.0-Roadmap).
54
+ We have a roadmap guiding our work toward the [v1.0.0 release](https://github.com/ruby-concurrency/concurrent-ruby/issues/257).
47
55
 
48
56
  The primary site for documentation is the automatically generated [API documentation](http://ruby-concurrency.github.io/concurrent-ruby/frames.html)
49
57
 
50
- We also have a [mailing list](http://groups.google.com/group/concurrent-ruby).
58
+ We also have a [mailing list](http://groups.google.com/group/concurrent-ruby) and [IRC (gitter)](https://gitter.im/ruby-concurrency/concurrent-ruby).
51
59
 
52
- 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.
60
+ 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.
53
61
 
54
62
  #### General-purpose Concurrency Abstractions
55
63
 
@@ -59,7 +67,7 @@ This library contains a variety of concurrency abstractions at high and low leve
59
67
  * [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
68
  * [Promise](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Promise.html): Similar to Futures, with more features.
61
69
  * [ScheduledTask](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ScheduledTask.html): Like a Future scheduled for a specific future time.
62
- * [TimerTask](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TimerTask.html): A Thread that periodically wakes up to perform work at regular intervals.
70
+ * [TimerTask](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TimerTask.html): A Thread that periodically wakes up to perform work at regular intervals.
63
71
 
64
72
  #### Thread-safe Value Objects
65
73
 
@@ -97,6 +105,7 @@ Derived from Ruby's [Struct](http://ruby-doc.org/core-2.2.0/Struct.html):
97
105
  * [Thread-local variables](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ThreadLocalVar.html)
98
106
  * [Software transactional memory](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TVar.html) (TVar)
99
107
  * [ReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ReadWriteLock.html)
108
+ * [ReentrantReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ReentrantReadWriteLock.html)
100
109
 
101
110
  ### Edge Features
102
111
 
@@ -108,34 +117,31 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
108
117
 
109
118
  * [Actor](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Actor.html):
110
119
  Implements the Actor Model, where concurrent actors exchange messages.
111
- * [new Future Framework](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge.html) - new
120
+ * [new Future Framework](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/FutureShortcuts.html) - new
112
121
  unified implementation of Futures and Promises which combines Features of previous `Future`,
113
122
  `Promise`, `IVar`, `Event`, `Probe`, `dataflow`, `Delay`, `TimerTask` into single framework. It uses extensively
114
- new synchronization layer to make all the paths **lock-free** with exception of blocking threads on `#wait`.
115
- It offers better performance and does not block threads when not required.
123
+ new synchronization layer to make all the features **non-blocking** and **lock-free** with exception of obviously blocking
124
+ operations like `#wait`, `#value`. It also offers better performance.
116
125
  * [Agent](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Agent.html): A single atomic value that represents an identity.
117
126
  * [Channel](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Channel.html):
118
127
  Communicating Sequential Processes (CSP).
119
128
  * [Exchanger](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Exchanger.html)
120
129
  * [LazyRegister](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/LazyRegister.html)
121
- * [New Future Promise Framework](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge.html) - new
122
- unified implementation of Futures and Promises which combines Features of previous `Future`,
123
- `Promise`, `IVar`, `Probe`, `dataflow`, `Delay`, `TimerTask` into single framework. It uses extensively
124
- new synchronization layer to make all the paths lock-free with exception of blocking threads on `#wait`.
125
- It offers better performance and does not block threads (exception being `#wait` and similar methods where it's
126
- intended).
127
-
130
+ * [Atomic Markable Reference](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/AtomicMarkableReference.html)
131
+ * [LockFreeLinked Set](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/LockFreeLinkedSet.html)
132
+ * [LockFreeStack](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/LockFreeStack.html)
128
133
 
129
134
  #### Statuses:
130
135
 
131
136
  *Why are these not in core?*
132
137
 
133
- - **Actor** - Partial documentation and tests; stability is good.
138
+ - **Actor** - Partial documentation and tests; stability is good.
134
139
  - **Future/Promise Framework** - API changes; partial documentation and tests; stability good.
135
140
  - **Agent** - Incomplete behaviour compared to Clojure's models; stability good.
136
141
  - **Channel** - Missing documentation; limted features; stability good.
137
142
  - **Exchanger** - Known race condition requiring a new implementation.
138
- - **LazyRegister** - Missing documentation and tests.
143
+ - **LazyRegister** - Missing documentation and tests.
144
+ - **AtomicMarkableReference, LockFreeLinkedSet, LockFreeStack** - Needs real world battle testing
139
145
 
140
146
  ## Usage
141
147
 
@@ -179,8 +185,6 @@ require 'concurrent/actor' # Concurrent::Actor and supporting code
179
185
  require 'concurrent/edge/future' # new Future Framework
180
186
  require 'concurrent/agent' # Concurrent::Agent
181
187
  require 'concurrent/channel ' # Concurrent::Channel and supporting code
182
- require 'concurrent/exchanger' # Concurrent::Exchanger
183
- require 'concurrent/lazy_register' # Concurrent::LazyRegister
184
188
  ```
185
189
 
186
190
  If the library does not behave as expected, `Concurrent.use_stdlib_logger(Logger::DEBUG)` could help to reveal the problem.
@@ -33,14 +33,26 @@ VALUE method_atomic_fixnum_value_set(VALUE self, VALUE value) {
33
33
  return(value);
34
34
  }
35
35
 
36
- VALUE method_atomic_fixnum_increment(VALUE self) {
36
+ VALUE method_atomic_fixnum_increment(int argc, VALUE* argv, VALUE self) {
37
37
  long long value = NUM2LL((VALUE) DATA_PTR(self));
38
- return method_atomic_fixnum_value_set(self, LL2NUM(value + 1));
38
+ long long delta = 1;
39
+ rb_check_arity(argc, 0, 1);
40
+ if (argc == 1) {
41
+ Check_Type(argv[0], T_FIXNUM);
42
+ delta = NUM2LL(argv[0]);
43
+ }
44
+ return method_atomic_fixnum_value_set(self, LL2NUM(value + delta));
39
45
  }
40
46
 
41
- VALUE method_atomic_fixnum_decrement(VALUE self) {
47
+ VALUE method_atomic_fixnum_decrement(int argc, VALUE* argv, VALUE self) {
42
48
  long long value = NUM2LL((VALUE) DATA_PTR(self));
43
- return method_atomic_fixnum_value_set(self, LL2NUM(value - 1));
49
+ long long delta = 1;
50
+ rb_check_arity(argc, 0, 1);
51
+ if (argc == 1) {
52
+ Check_Type(argv[0], T_FIXNUM);
53
+ delta = NUM2LL(argv[0]);
54
+ }
55
+ return method_atomic_fixnum_value_set(self, LL2NUM(value - delta));
44
56
  }
45
57
 
46
58
  VALUE method_atomic_fixnum_compare_and_set(VALUE self, VALUE rb_expect, VALUE rb_update) {
@@ -48,3 +60,14 @@ VALUE method_atomic_fixnum_compare_and_set(VALUE self, VALUE rb_expect, VALUE rb
48
60
  Check_Type(rb_update, T_FIXNUM);
49
61
  return ir_compare_and_set(self, rb_expect, rb_update);
50
62
  }
63
+
64
+ VALUE method_atomic_fixnum_update(VALUE self) {
65
+ VALUE old_value, new_value;
66
+ for (;;) {
67
+ old_value = method_atomic_fixnum_value(self);
68
+ new_value = rb_yield(old_value);
69
+ if (ir_compare_and_set(self, old_value, new_value) == Qtrue) {
70
+ return new_value;
71
+ }
72
+ }
73
+ }
@@ -6,8 +6,9 @@ VALUE atomic_fixnum_allocate(VALUE);
6
6
  VALUE method_atomic_fixnum_initialize(int, VALUE*, VALUE);
7
7
  VALUE method_atomic_fixnum_value(VALUE);
8
8
  VALUE method_atomic_fixnum_value_set(VALUE, VALUE);
9
- VALUE method_atomic_fixnum_increment(VALUE);
10
- VALUE method_atomic_fixnum_decrement(VALUE);
9
+ VALUE method_atomic_fixnum_increment(int, VALUE*, VALUE);
10
+ VALUE method_atomic_fixnum_decrement(int, VALUE*, VALUE);
11
11
  VALUE method_atomic_fixnum_compare_and_set(VALUE, VALUE, VALUE);
12
+ VALUE method_atomic_fixnum_update(VALUE);
12
13
 
13
14
  #endif
@@ -49,9 +49,10 @@ void Init_extension() {
49
49
  rb_define_method(rb_cAtomicFixnum, "initialize", method_atomic_fixnum_initialize, -1);
50
50
  rb_define_method(rb_cAtomicFixnum, "value", method_atomic_fixnum_value, 0);
51
51
  rb_define_method(rb_cAtomicFixnum, "value=", method_atomic_fixnum_value_set, 1);
52
- rb_define_method(rb_cAtomicFixnum, "increment", method_atomic_fixnum_increment, 0);
53
- rb_define_method(rb_cAtomicFixnum, "decrement", method_atomic_fixnum_decrement, 0);
52
+ rb_define_method(rb_cAtomicFixnum, "increment", method_atomic_fixnum_increment, -1);
53
+ rb_define_method(rb_cAtomicFixnum, "decrement", method_atomic_fixnum_decrement, -1);
54
54
  rb_define_method(rb_cAtomicFixnum, "compare_and_set", method_atomic_fixnum_compare_and_set, 2);
55
+ rb_define_method(rb_cAtomicFixnum, "update", method_atomic_fixnum_update, 0);
55
56
  rb_define_alias(rb_cAtomicFixnum, "up", "increment");
56
57
  rb_define_alias(rb_cAtomicFixnum, "down", "decrement");
57
58
  }
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
4
+ version: 0.9.1
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-07-10 00:00:00.000000000 Z
11
+ date: 2015-08-09 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
19
+ version: 0.9.1
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
26
+ version: 0.9.1
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.