Skip to content

Commit c12f503

Browse files
committedMar 21, 2016
Use built-in finalizer protocol for IO-related objects.
1 parent baff08a commit c12f503

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎core/io.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def initialize(fd, stat, io)
190190
# Sometimes a FileDescriptor class is replaced (see IO#reopen) so we need to be
191191
# careful we don't finalize that descriptor. Probably need a way to cancel
192192
# the finalization when we are transferring an FD from one instance to another.
193-
ObjectSpace.define_finalizer(self, method(:finalizer))
193+
ObjectSpace.define_finalizer(self)
194194
end
195195
end
196196

@@ -563,7 +563,7 @@ def cancel_finalizer
563563
ObjectSpace.undefine_finalizer(self)
564564
end
565565

566-
def finalizer(obj_id)
566+
def __finalize__
567567
return if @descriptor.nil? || @descriptor == -1
568568

569569
fd = @descriptor

0 commit comments

Comments
 (0)
Please sign in to comment.