Skip to content

Commit 990bdf8

Browse files
committed
Fix failing channel tests on JRuby
1 parent 662ba4a commit 990bdf8

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

spec/concurrent/channel/buffered_channel_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ module Concurrent
5353

5454
describe '#pop' do
5555
it 'should block if buffer is empty' do
56-
t = Thread.new { channel.pop }
57-
sleep(0.05)
58-
expect(t.status).to eq 'sleep'
56+
event = Event.new
57+
Thread.new { channel.pop; event.set }
58+
expect(event.wait(0.1)).to eq false
59+
channel.push true
5960
end
6061

6162
it 'returns value if buffer is not empty' do

spec/concurrent/channel/unbuffered_channel_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ module Concurrent
1919

2020
describe '#pop' do
2121
it 'should block' do
22-
t = Thread.new { channel.pop }
23-
sleep(0.05)
24-
expect(t.status).to eq 'sleep'
22+
event = Event.new
23+
Thread.new { channel.pop; event.set }
24+
expect(event.wait(0.1)).to eq false
25+
channel.push true
2526
end
2627
end
2728

0 commit comments

Comments
 (0)