File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,10 @@ module Concurrent
53
53
54
54
describe '#pop' do
55
55
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
59
60
end
60
61
61
62
it 'returns value if buffer is not empty' do
Original file line number Diff line number Diff line change @@ -19,9 +19,10 @@ module Concurrent
19
19
20
20
describe '#pop' do
21
21
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
25
26
end
26
27
end
27
28
You can’t perform that action at this time.
0 commit comments