We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49980ed commit 3b1114eCopy full SHA for 3b1114e
lib/concurrent/agent.rb
@@ -152,7 +152,7 @@ def <<(block)
152
# @return [Boolean] false on timeout, true otherwise
153
def await(timeout = nil)
154
done = Event.new
155
- post { done.set }
+ post { |val| done.set; val }
156
done.wait timeout
157
end
158
spec/concurrent/agent_spec.rb
@@ -189,6 +189,12 @@ def trigger_observable(observable)
189
fn.should be_false
190
191
192
+ it 'does not alter the value' do
193
+ subject.post { |v| v + 1 }
194
+ subject.await
195
+ subject.value.should eq 1
196
+ end
197
+
198
199
200
context 'fulfillment' do
0 commit comments