Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2013, 2024 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 2.0, or
* GNU General Public License version 2, or
* GNU Lesser General Public License version 2.1.
*/
package org.truffleruby.core;
import java.lang.ref.ReferenceQueue;
import java.util.Collection;
import java.util.Objects;
import org.truffleruby.RubyContext;
import org.truffleruby.RubyLanguage;
import org.truffleruby.core.MarkingService.ExtensionCallStack;
import org.truffleruby.language.RubyDynamicObject;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
/** Finalizers are implemented with phantom references and reference queues, and are run in a dedicated Ruby thread. */
public final class FinalizationService extends ReferenceProcessingService {
static final class Finalizer {
private final Class> owner;
private final Runnable action;
private final RubyDynamicObject root;
public Finalizer(Class> owner, Runnable action, RubyDynamicObject root) {
this.owner = owner;
this.action = action;
this.root = root;
}
public Class> getOwner() {
return owner;
}
public Runnable getAction() {
return action;
}
public RubyDynamicObject getRoot() {
return root;
}
}
public FinalizationService(ReferenceQueue