concurrent-ruby 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/README.md +1 -1
- data/lib/concurrent/atomic/abstract_thread_local_var.rb +2 -0
- data/lib/concurrent/atomic/atomic_boolean.rb +6 -0
- data/lib/concurrent/atomic/atomic_fixnum.rb +3 -1
- data/lib/concurrent/atomic/atomic_reference.rb +2 -0
- data/lib/concurrent/atomic/event.rb +20 -0
- data/lib/concurrent/atomic/semaphore.rb +32 -0
- data/lib/concurrent/edge.rb +0 -4
- data/lib/concurrent/synchronization/condition.rb +3 -0
- data/lib/concurrent/synchronization/lock.rb +1 -0
- data/lib/concurrent/synchronization/object.rb +1 -0
- data/lib/concurrent/version.rb +2 -2
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2ef80367a4e0135992f3f9ca212bf6a32093bf2
|
4
|
+
data.tar.gz: 435bf341ed840ee101e920819d6cb69c942223f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88d799188af8df8c6f5fdab76e88207dd573815528f75f8739738256a82b831e8beab1b5991ec8554f073f8fc212d357c657306fb0b0f2f88810b7d3ba16efaa
|
7
|
+
data.tar.gz: f2b6da535200eac3c255fb6b6e552fe0cff22935d85b7de03337e52383a81adc22bb6236cabf3757fe4632cfc07b0c33ef658c7ba95278dc41c3af2a40848d13
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,20 @@
|
|
1
|
-
##
|
1
|
+
## Release v1.0.5, edge v0.3.1 (26 Feb 2017)
|
2
|
+
|
3
|
+
concurrent-ruby:
|
4
|
+
|
5
|
+
* Documentation for Event and Semaphore
|
6
|
+
* Use Unsafe#fullFence and #loadFence directly since the shortcuts were removed in JRuby
|
7
|
+
* Do not depend on org.jruby.util.unsafe.UnsafeHolder
|
8
|
+
|
9
|
+
concurrent-ruby-edge:
|
10
|
+
|
11
|
+
* (#620) Actors on Pool raise an error
|
12
|
+
* (#624) Delayed promises did not interact correctly with flatting
|
13
|
+
* Fix arguments yielded by callback methods
|
14
|
+
* Overridable default executor in promises factory methods
|
15
|
+
* Asking actor to terminate will always resolve to `true`
|
16
|
+
|
17
|
+
## Release v1.0.4, edge v0.3.0 (27 Dec 2016)
|
2
18
|
|
3
19
|
concurrent-ruby:
|
4
20
|
|
data/README.md
CHANGED
@@ -84,7 +84,7 @@ Structure classes derived from Ruby's [Struct](http://ruby-doc.org/core-2.2.0/St
|
|
84
84
|
|
85
85
|
Thread-safe variables:
|
86
86
|
|
87
|
-
* [Agent](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Agent.html): A way to manage shared, mutable, *asynchronous*, independent
|
87
|
+
* [Agent](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Agent.html): A way to manage shared, mutable, *asynchronous*, independent state. Based on Clojure's [Agent](http://clojure.org/agents).
|
88
88
|
* [Atom](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Atom.html): A way to manage shared, mutable, *synchronous*, independent state. Based on Clojure's [Atom](http://clojure.org/atoms).
|
89
89
|
* [AtomicBoolean](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/AtomicBoolean.html) A boolean value that can be updated atomically.
|
90
90
|
* [AtomicFixnum](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/AtomicFixnum.html) A numeric value that can be updated atomically.
|
@@ -112,5 +112,11 @@ module Concurrent
|
|
112
112
|
#
|
113
113
|
# @!macro atomic_boolean_public_api
|
114
114
|
class AtomicBoolean < AtomicBooleanImplementation
|
115
|
+
# @return [String] Short string representation.
|
116
|
+
def to_s
|
117
|
+
format '<#%s:0x%x value:%s>', self.class, object_id << 1, value
|
118
|
+
end
|
119
|
+
|
120
|
+
alias_method :inspect, :to_s
|
115
121
|
end
|
116
122
|
end
|
@@ -131,7 +131,9 @@ module Concurrent
|
|
131
131
|
class AtomicFixnum < AtomicFixnumImplementation
|
132
132
|
# @return [String] Short string representation.
|
133
133
|
def to_s
|
134
|
-
format '<#%s:0x%x value:%s>', self.class, object_id << 1,
|
134
|
+
format '<#%s:0x%x value:%s>', self.class, object_id << 1, value
|
135
135
|
end
|
136
|
+
|
137
|
+
alias_method :inspect, :to_s
|
136
138
|
end
|
137
139
|
end
|
@@ -13,6 +13,26 @@ module Concurrent
|
|
13
13
|
# `#reset` at any time once it has been set.
|
14
14
|
#
|
15
15
|
# @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms682655.aspx
|
16
|
+
# @example
|
17
|
+
# event = Concurrent::Event.new
|
18
|
+
#
|
19
|
+
# t1 = Thread.new do
|
20
|
+
# puts "t1 is waiting"
|
21
|
+
# event.wait(1)
|
22
|
+
# puts "event ocurred"
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# t2 = Thread.new do
|
26
|
+
# puts "t2 calling set"
|
27
|
+
# event.set
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# [t1, t2].each(&:join)
|
31
|
+
#
|
32
|
+
# # prints:
|
33
|
+
# # t2 calling set
|
34
|
+
# # t1 is waiting
|
35
|
+
# # event ocurred
|
16
36
|
class Event < Synchronization::LockableObject
|
17
37
|
|
18
38
|
# Creates a new `Event` in the unset state. Threads calling `#wait` on the
|
@@ -108,6 +108,38 @@ module Concurrent
|
|
108
108
|
# count of the number available and acts accordingly.
|
109
109
|
#
|
110
110
|
# @!macro semaphore_public_api
|
111
|
+
# @example
|
112
|
+
# semaphore = Concurrent::Semaphore.new(2)
|
113
|
+
#
|
114
|
+
# t1 = Thread.new do
|
115
|
+
# semaphore.acquire
|
116
|
+
# puts "Thread 1 acquired semaphore"
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# t2 = Thread.new do
|
120
|
+
# semaphore.acquire
|
121
|
+
# puts "Thread 2 acquired semaphore"
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# t3 = Thread.new do
|
125
|
+
# semaphore.acquire
|
126
|
+
# puts "Thread 3 acquired semaphore"
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
# t4 = Thread.new do
|
130
|
+
# sleep(2)
|
131
|
+
# puts "Thread 4 releasing semaphore"
|
132
|
+
# semaphore.release
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
# [t1, t2, t3, t4].each(&:join)
|
136
|
+
#
|
137
|
+
# # prints:
|
138
|
+
# # Thread 3 acquired semaphore
|
139
|
+
# # Thread 2 acquired semaphore
|
140
|
+
# # Thread 4 releasing semaphore
|
141
|
+
# # Thread 1 acquired semaphore
|
142
|
+
#
|
111
143
|
class Semaphore < SemaphoreImplementation
|
112
144
|
end
|
113
145
|
end
|
data/lib/concurrent/edge.rb
CHANGED
@@ -15,10 +15,6 @@ module Concurrent
|
|
15
15
|
# features should remain in this module until merged into the core gem. This
|
16
16
|
# will prevent namespace collisions.
|
17
17
|
#
|
18
|
-
# This file should *never* be used as a global `require` for all files within
|
19
|
-
# the edge gem. Because these features are experimental users should always
|
20
|
-
# explicitly require only what they need.
|
21
|
-
#
|
22
18
|
# @!macro [attach] edge_warning
|
23
19
|
# @api Edge
|
24
20
|
# @note **Edge Feature:** Edge features are under active development and may change frequently. They are expected not to
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module Concurrent
|
2
2
|
module Synchronization
|
3
|
+
# TODO (pitr-ch 04-Dec-2016): should be in edge
|
3
4
|
class Condition < LockableObject
|
4
5
|
safe_initialization!
|
5
6
|
|
6
7
|
# TODO (pitr 12-Sep-2015): locks two objects, improve
|
8
|
+
# TODO (pitr 26-Sep-2015): study
|
9
|
+
# http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/util/concurrent/locks/AbstractQueuedSynchronizer.java#AbstractQueuedSynchronizer.Node
|
7
10
|
|
8
11
|
singleton_class.send :alias_method, :private_new, :new
|
9
12
|
private_class_method :new
|
@@ -22,6 +22,7 @@ module Concurrent
|
|
22
22
|
# - volatile instance variables see {Object.attr_volatile}
|
23
23
|
# - volatile instance variables see {Object.attr_atomic}
|
24
24
|
class Object < ObjectImplementation
|
25
|
+
# TODO make it a module if possible
|
25
26
|
|
26
27
|
# @!method self.attr_volatile(*names)
|
27
28
|
# Creates methods for reading and writing (as `attr_accessor` does) to a instance variable with
|
data/lib/concurrent/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry D'Antonio
|
@@ -10,14 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-02-26 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: |
|
16
16
|
Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
|
17
17
|
Inspired by Erlang, Clojure, Go, JavaScript, actors, and classic concurrency patterns.
|
18
|
-
email:
|
19
|
-
- jerry.dantonio@gmail.com
|
20
|
-
- concurrent-ruby@googlegroups.com
|
18
|
+
email: concurrent-ruby@googlegroups.com
|
21
19
|
executables: []
|
22
20
|
extensions: []
|
23
21
|
extra_rdoc_files:
|
@@ -171,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
169
|
version: '0'
|
172
170
|
requirements: []
|
173
171
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.6.8
|
175
173
|
signing_key:
|
176
174
|
specification_version: 4
|
177
175
|
summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell,
|