concurrent-ruby 1.1.0.pre1 → 1.1.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/README.md +2 -2
- data/Rakefile +2 -1
- data/lib/concurrent/collection/lock_free_stack.rb +39 -8
- data/lib/concurrent/concurrent_ruby.jar +0 -0
- data/lib/concurrent/promises.rb +0 -2
- data/lib/concurrent/set.rb +2 -2
- data/lib/concurrent/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9eff851dc1c1194d74471f51e804151e6523be1af22c681393518897d8723e7
|
4
|
+
data.tar.gz: 97aea57e3c31de3e0a927b07b5bbae7a5b2859537fe959f08d045fadc86d818a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee74332b245d576afd75179edf7d37e2d815e0f24afe157e9b76189c7275e60a8edc348646d659c5d631e73fa5382a57a94ec82c6b4bb909a993f86b45677192
|
7
|
+
data.tar.gz: d21e2f11e2c3f9090cbb4e7dada48cd64d3eb3a9c7588417b6e52975ebe0a0f8fafc612695c46cd58f94389c7597800c038a57f89fa70db936493b007890d1e7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -144,7 +144,7 @@ Thread-safe variables:
|
|
144
144
|
A boolean value that can be updated atomically.
|
145
145
|
* [AtomicFixnum](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicFixnum.html)
|
146
146
|
A numeric value that can be updated atomically.
|
147
|
-
* [AtomicReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/
|
147
|
+
* [AtomicReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicReference.html)
|
148
148
|
An object reference that may be updated atomically.
|
149
149
|
* [Exchanger](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Exchanger.html)
|
150
150
|
A synchronization point at which threads can pair and swap elements within pairs. Based on
|
@@ -178,7 +178,7 @@ Thread-safe variables:
|
|
178
178
|
A read/write lock with reentrant and upgrade features.
|
179
179
|
* [Semaphore](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Semaphore.html)
|
180
180
|
A counting-based locking mechanism that uses permits.
|
181
|
-
* [AtomicMarkableReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/
|
181
|
+
* [AtomicMarkableReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicMarkableReference.html)
|
182
182
|
|
183
183
|
#### Deprecated
|
184
184
|
|
data/Rakefile
CHANGED
@@ -33,6 +33,7 @@ namespace :repackage do
|
|
33
33
|
task :all do
|
34
34
|
Dir.chdir(__dir__) do
|
35
35
|
sh 'bundle package'
|
36
|
+
# needed only if the jar is built outside of docker
|
36
37
|
Rake::Task['lib/concurrent/concurrent_ruby.jar'].invoke
|
37
38
|
RakeCompilerDock.exec 'support/cross_building.sh'
|
38
39
|
end
|
@@ -192,7 +193,7 @@ rescue LoadError => e
|
|
192
193
|
end
|
193
194
|
|
194
195
|
desc 'build, test, and publish the gem'
|
195
|
-
task :release => ['release:checks', 'release:build', 'release:test']
|
196
|
+
task :release => ['release:checks', 'release:build', 'release:test', 'release:publish']
|
196
197
|
|
197
198
|
namespace :release do
|
198
199
|
# Depends on environment of @pitr-ch
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Concurrent
|
2
2
|
|
3
|
-
# @!
|
3
|
+
# @!macro warn.edge
|
4
4
|
class LockFreeStack < Synchronization::Object
|
5
5
|
|
6
6
|
safe_initialization!
|
@@ -8,7 +8,13 @@ module Concurrent
|
|
8
8
|
class Node
|
9
9
|
# TODO (pitr-ch 20-Dec-2016): Could be unified with Stack class?
|
10
10
|
|
11
|
-
|
11
|
+
# @return [Node]
|
12
|
+
attr_reader :next_node
|
13
|
+
|
14
|
+
# @return [Object]
|
15
|
+
attr_reader :value
|
16
|
+
|
17
|
+
# @!visibility private
|
12
18
|
# allow to nil-ify to free GC when the entry is no longer relevant, not synchronised
|
13
19
|
attr_writer :value
|
14
20
|
|
@@ -20,38 +26,46 @@ module Concurrent
|
|
20
26
|
singleton_class.send :alias_method, :[], :new
|
21
27
|
end
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
# The singleton for empty node
|
30
|
+
EMPTY = Node[nil, nil]
|
31
|
+
def EMPTY.next_node
|
32
|
+
self
|
27
33
|
end
|
28
34
|
|
29
|
-
EMPTY = Empty[nil, nil]
|
30
|
-
|
31
35
|
attr_atomic(:head)
|
32
36
|
private :head, :head=, :swap_head, :compare_and_set_head, :update_head
|
33
37
|
|
38
|
+
# @!visibility private
|
34
39
|
def self.of1(value)
|
35
40
|
new Node[value, EMPTY]
|
36
41
|
end
|
37
42
|
|
43
|
+
# @!visibility private
|
38
44
|
def self.of2(value1, value2)
|
39
45
|
new Node[value1, Node[value2, EMPTY]]
|
40
46
|
end
|
41
47
|
|
48
|
+
# @param [Node] head
|
42
49
|
def initialize(head = EMPTY)
|
43
50
|
super()
|
44
51
|
self.head = head
|
45
52
|
end
|
46
53
|
|
54
|
+
# @param [Node] head
|
55
|
+
# @return [true, false]
|
47
56
|
def empty?(head = self.head)
|
48
57
|
head.equal? EMPTY
|
49
58
|
end
|
50
59
|
|
60
|
+
# @param [Node] head
|
61
|
+
# @param [Object] value
|
62
|
+
# @return [true, false]
|
51
63
|
def compare_and_push(head, value)
|
52
64
|
compare_and_set_head head, Node[value, head]
|
53
65
|
end
|
54
66
|
|
67
|
+
# @param [Object] value
|
68
|
+
# @return [self]
|
55
69
|
def push(value)
|
56
70
|
while true
|
57
71
|
current_head = head
|
@@ -59,14 +73,18 @@ module Concurrent
|
|
59
73
|
end
|
60
74
|
end
|
61
75
|
|
76
|
+
# @return [Node]
|
62
77
|
def peek
|
63
78
|
head
|
64
79
|
end
|
65
80
|
|
81
|
+
# @param [Node] head
|
82
|
+
# @return [true, false]
|
66
83
|
def compare_and_pop(head)
|
67
84
|
compare_and_set_head head, head.next_node
|
68
85
|
end
|
69
86
|
|
87
|
+
# @return [Object]
|
70
88
|
def pop
|
71
89
|
while true
|
72
90
|
current_head = head
|
@@ -74,12 +92,16 @@ module Concurrent
|
|
74
92
|
end
|
75
93
|
end
|
76
94
|
|
95
|
+
# @param [Node] head
|
96
|
+
# @return [true, false]
|
77
97
|
def compare_and_clear(head)
|
78
98
|
compare_and_set_head head, EMPTY
|
79
99
|
end
|
80
100
|
|
81
101
|
include Enumerable
|
82
102
|
|
103
|
+
# @param [Node] head
|
104
|
+
# @return [self]
|
83
105
|
def each(head = nil)
|
84
106
|
return to_enum(:each, head) unless block_given?
|
85
107
|
it = head || peek
|
@@ -90,6 +112,7 @@ module Concurrent
|
|
90
112
|
self
|
91
113
|
end
|
92
114
|
|
115
|
+
# @return [true, false]
|
93
116
|
def clear
|
94
117
|
while true
|
95
118
|
current_head = head
|
@@ -98,14 +121,22 @@ module Concurrent
|
|
98
121
|
end
|
99
122
|
end
|
100
123
|
|
124
|
+
# @param [Node] head
|
125
|
+
# @return [true, false]
|
101
126
|
def clear_if(head)
|
102
127
|
compare_and_set_head head, EMPTY
|
103
128
|
end
|
104
129
|
|
130
|
+
# @param [Node] head
|
131
|
+
# @param [Node] new_head
|
132
|
+
# @return [true, false]
|
105
133
|
def replace_if(head, new_head)
|
106
134
|
compare_and_set_head head, new_head
|
107
135
|
end
|
108
136
|
|
137
|
+
# @return [self]
|
138
|
+
# @yield over the cleared stack
|
139
|
+
# @yieldparam [Object] value
|
109
140
|
def clear_each(&block)
|
110
141
|
while true
|
111
142
|
current_head = head
|
Binary file
|
data/lib/concurrent/promises.rb
CHANGED
@@ -495,7 +495,6 @@ module Concurrent
|
|
495
495
|
@Promise = promise
|
496
496
|
@DefaultExecutor = default_executor
|
497
497
|
@Callbacks = LockFreeStack.new
|
498
|
-
# noinspection RubyArgCount
|
499
498
|
@Waiters = AtomicFixnum.new 0
|
500
499
|
self.internal_state = PENDING
|
501
500
|
end
|
@@ -1420,7 +1419,6 @@ module Concurrent
|
|
1420
1419
|
def initialize(delayed, blockers_count, future)
|
1421
1420
|
super(future)
|
1422
1421
|
@Delayed = delayed
|
1423
|
-
# noinspection RubyArgCount
|
1424
1422
|
@Countdown = AtomicFixnum.new blockers_count
|
1425
1423
|
end
|
1426
1424
|
|
data/lib/concurrent/set.rb
CHANGED
@@ -41,7 +41,7 @@ module Concurrent
|
|
41
41
|
|
42
42
|
class RbxSet < ::Set
|
43
43
|
end
|
44
|
-
ThreadSafe::Util.make_synchronized_on_rbx Concurrent::
|
44
|
+
ThreadSafe::Util.make_synchronized_on_rbx Concurrent::RbxSet
|
45
45
|
RbxSet
|
46
46
|
|
47
47
|
when Concurrent.on_truffleruby?
|
@@ -50,7 +50,7 @@ module Concurrent
|
|
50
50
|
class TruffleRubySet < ::Set
|
51
51
|
end
|
52
52
|
|
53
|
-
ThreadSafe::Util.make_synchronized_on_truffleruby Concurrent::
|
53
|
+
ThreadSafe::Util.make_synchronized_on_truffleruby Concurrent::TruffleRubySet
|
54
54
|
TruffleRubySet
|
55
55
|
|
56
56
|
else
|
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.1.0.
|
4
|
+
version: 1.1.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry D'Antonio
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-09-18 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.
|