concurrent-ruby-edge 0.2.0.pre5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 483222056a02ba17d68abfa363b9724752bd1afb
|
4
|
+
data.tar.gz: 6aeaffa48b1e72537dfc0cd4d7e2192f9f0a9b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd2568bd3bc5a0475f010707956951699b261d436350031ec07426d724202754d7b4ca24424fd39ef7b9cdfbaf1be15191c32dc810486ef550f3348451f6915a
|
7
|
+
data.tar.gz: 99c27ac66c7e2071ff4d641e5a6ea9c0a9d1a9a57cfc63e7603248ef160461981fcd6127cc29c05a487aee66c5a48110312030955695eb5c4d15829c9c2ce8f2
|
data/lib/concurrent/channel.rb
CHANGED
@@ -11,7 +11,7 @@ module Concurrent
|
|
11
11
|
# @api Edge
|
12
12
|
class AtomicMarkableReference < ::Concurrent::Synchronization::Object
|
13
13
|
|
14
|
-
private(*
|
14
|
+
private(*attr_atomic(:reference))
|
15
15
|
|
16
16
|
# @!macro [attach] atomic_markable_reference_method_initialize
|
17
17
|
def initialize(value = nil, mark = false)
|
@@ -131,7 +131,7 @@ module Concurrent
|
|
131
131
|
# Represents an event which will happen in future (will be completed). It has to always happen.
|
132
132
|
class Event < Synchronization::LockableObject
|
133
133
|
safe_initialization!
|
134
|
-
private(*
|
134
|
+
private(*attr_atomic(:internal_state))
|
135
135
|
public :internal_state
|
136
136
|
include Concern::Deprecation
|
137
137
|
include Concern::Logging
|
@@ -176,13 +176,13 @@ module Concurrent
|
|
176
176
|
|
177
177
|
def initialize(promise, default_executor)
|
178
178
|
super()
|
179
|
-
@Promise
|
180
|
-
@DefaultExecutor
|
181
|
-
@Touched
|
182
|
-
@Callbacks
|
179
|
+
@Promise = promise
|
180
|
+
@DefaultExecutor = default_executor
|
181
|
+
@Touched = AtomicBoolean.new(false)
|
182
|
+
@Callbacks = LockFreeStack.new
|
183
183
|
# TODO (pitr 12-Sep-2015): replace with AtomicFixnum, avoid aba problem
|
184
184
|
# TODO (pitr 12-Sep-2015): look at java.util.concurrent solution
|
185
|
-
@Waiters
|
185
|
+
@Waiters = LockFreeStack.new
|
186
186
|
self.internal_state = PENDING
|
187
187
|
end
|
188
188
|
|
@@ -23,7 +23,7 @@ module Concurrent
|
|
23
23
|
|
24
24
|
EMPTY = Empty[nil, nil]
|
25
25
|
|
26
|
-
private(*
|
26
|
+
private(*attr_atomic(:head))
|
27
27
|
|
28
28
|
def initialize
|
29
29
|
super()
|
@@ -64,6 +64,18 @@ module Concurrent
|
|
64
64
|
compare_and_set_head head, EMPTY
|
65
65
|
end
|
66
66
|
|
67
|
+
include Enumerable
|
68
|
+
|
69
|
+
def each(head = nil)
|
70
|
+
return to_enum(:each, head) unless block_given?
|
71
|
+
it = head || peek
|
72
|
+
until it.equal?(EMPTY)
|
73
|
+
yield it.value
|
74
|
+
it = it.next_node
|
75
|
+
end
|
76
|
+
self
|
77
|
+
end
|
78
|
+
|
67
79
|
def clear
|
68
80
|
while true
|
69
81
|
current_head = head
|
@@ -72,16 +84,15 @@ module Concurrent
|
|
72
84
|
end
|
73
85
|
end
|
74
86
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
87
|
+
def clear_each(&block)
|
88
|
+
while true
|
89
|
+
current_head = head
|
90
|
+
return self if current_head == EMPTY
|
91
|
+
if compare_and_set_head current_head, EMPTY
|
92
|
+
each current_head, &block
|
93
|
+
return self
|
94
|
+
end
|
83
95
|
end
|
84
|
-
self
|
85
96
|
end
|
86
97
|
|
87
98
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concurrent-ruby-edge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0
|
4
|
+
version: 0.2.0
|
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: 2015-11-
|
13
|
+
date: 2015-11-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: concurrent-ruby
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.0.0
|
21
|
+
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.0.0
|
28
|
+
version: 1.0.0
|
29
29
|
description: |
|
30
30
|
These features are under active development and may change frequently. They are expected not to
|
31
31
|
keep backward compatibility (there may also lack tests and documentation). Semantic versions will
|
@@ -108,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: 1.9.3
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - "
|
111
|
+
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
113
|
+
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
116
|
rubygems_version: 2.4.8
|