concurrent-ruby-edge 0.2.0.pre5 → 0.2.0

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: 49c297b646de061530808c991d1e19221dc1b6a7
4
- data.tar.gz: 1301f31a7ff10f078525eb5e3158428b012d1517
3
+ metadata.gz: 483222056a02ba17d68abfa363b9724752bd1afb
4
+ data.tar.gz: 6aeaffa48b1e72537dfc0cd4d7e2192f9f0a9b7f
5
5
  SHA512:
6
- metadata.gz: 9b4850c4f01294b27c7bfeae6a0ad37ee22a255be4097e318fcfeca022de20f5436a756ea7ff7754f39148483c728a6867267b585240719d2d9981fc317c1944
7
- data.tar.gz: 46e2136e70cc3b20d1fd3f4a118010b4c26190bd218811fea3a3e53cb03668a89a5744f7f59e71aefa498ed6936f61deab8d4fe525c0a466ff9f95e620e2ed3a
6
+ metadata.gz: bd2568bd3bc5a0475f010707956951699b261d436350031ec07426d724202754d7b4ca24424fd39ef7b9cdfbaf1be15191c32dc810486ef550f3348451f6915a
7
+ data.tar.gz: 99c27ac66c7e2071ff4d641e5a6ea9c0a9d1a9a57cfc63e7603248ef160461981fcd6127cc29c05a487aee66c5a48110312030955695eb5c4d15829c9c2ce8f2
@@ -1,3 +1,5 @@
1
+ require 'forwardable'
2
+
1
3
  require 'concurrent/channel/buffer'
2
4
  require 'concurrent/channel/selector'
3
5
 
@@ -11,7 +11,7 @@ module Concurrent
11
11
  # @api Edge
12
12
  class AtomicMarkableReference < ::Concurrent::Synchronization::Object
13
13
 
14
- private(*attr_volatile_with_cas(:reference))
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(*attr_volatile_with_cas(:internal_state))
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 = promise
180
- @DefaultExecutor = default_executor
181
- @Touched = AtomicBoolean.new(false)
182
- @Callbacks = LockFreeStack.new
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 = LockFreeStack.new
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(*attr_volatile_with_cas(:head))
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
- include Enumerable
76
-
77
- def each
78
- return to_enum unless block_given?
79
- it = peek
80
- until it.equal?(EMPTY)
81
- yield it.value
82
- it = it.next_node
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.pre5
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-04 00:00:00.000000000 Z
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.pre5
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.pre5
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: 1.3.1
113
+ version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
116
  rubygems_version: 2.4.8