Skip to content

Commit d0c8d48

Browse files
committed
Remove Truffle::Channel now that Queue can do pop(timeout:)
1 parent d2e5bfd commit d0c8d48

File tree

5 files changed

+9
-78
lines changed

5 files changed

+9
-78
lines changed

lib/truffle/timeout.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ def abort
8383
end
8484
end
8585

86-
@chan = Truffle::Channel.new
86+
@chan = Queue.new
8787

8888
def self.watch_channel
8989
reqs = []
9090

9191
loop do
9292
begin
9393
while reqs.empty?
94-
req = @chan.receive
94+
req = @chan.pop
9595
reqs << req if req
9696
end
9797

@@ -101,7 +101,7 @@ def self.watch_channel
101101
if min.left > 0
102102
before = Time.now
103103

104-
new_req = @chan.receive_timeout(min.left)
104+
new_req = @chan.pop(timeout: min.left)
105105

106106
slept_for = Time.now - before
107107
else

spec/truffle/objspace/define_finalizer_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
# The assumption is that this works as expected but is just hard to test.
2828

2929
it "will call the finalizer" do
30-
channel = Truffle::Channel.new
30+
queue = Queue.new
3131
finalizer = proc {
32-
channel.send :finalized
32+
queue << :finalized
3333
}
3434
Object.new.tap do |object|
3535
ObjectSpace.define_finalizer object, finalizer
3636
ObjectSpace.reachable_objects_from(object).should include(finalizer)
3737
end
3838
Primitive.gc_force
3939
Truffle::Debug.drain_finalization_queue # Not needed for correctness
40-
channel.receive_timeout(TIME_TOLERANCE).should == :finalized
40+
queue.pop(timeout: TIME_TOLERANCE).should == :finalized
4141
end
4242

4343
end

spec/truffle/objspace/undefine_finalizer_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
# See comment in define_finalizer_spec.rb
1818

1919
it "successfully unregisters a finalizer" do
20-
channel = Truffle::Channel.new
20+
queue = Queue.new
2121
Object.new.tap do |object|
2222
finalizer = proc {
23-
channel.send :finalized
23+
queue << :finalized
2424
}
2525
ObjectSpace.define_finalizer object, finalizer
2626
ObjectSpace.reachable_objects_from(object).should include(finalizer)
@@ -29,7 +29,7 @@
2929
end
3030
Primitive.gc_force
3131
Truffle::Debug.drain_finalization_queue # Not needed for correctness
32-
channel.try_receive.should be_nil
32+
queue.should.empty?
3333
end
3434

3535
end

src/main/java/org/truffleruby/core/CoreLibrary.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,6 @@ public boolean isTruffleBootMainMethod(SharedMethodInfo info) {
946946
"/core/pre.rb",
947947
"/core/basic_object.rb",
948948
"/core/array.rb",
949-
"/core/channel.rb",
950949
"/core/configuration.rb",
951950
"/core/false.rb",
952951
"/core/fiber.rb",

src/main/ruby/truffleruby/core/channel.rb

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)