All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vproxy.pni.graal.GraalPNIRef Maven / Gradle / Ivy

The newest version!
package io.vproxy.pni.graal;

import io.vproxy.pni.PNIRef;
import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.c.function.CEntryPoint;
import org.graalvm.nativeimage.c.function.CEntryPointLiteral;
import org.graalvm.nativeimage.c.function.CFunctionPointer;

import java.lang.foreign.MemorySegment;

public class GraalPNIRef {
    private static final CEntryPointLiteral releaseFunc
        = CEntryPointLiteral.create(GraalPNIRef.class, "release", IsolateThread.class, long.class);

    public static MemorySegment getReleaseFunctionPointer() {
        return MemorySegment.ofAddress(releaseFunc.getFunctionPointer().rawValue());
    }

    @SuppressWarnings("unused")
    @CEntryPoint
    public static void release(IsolateThread thread, long index) {
        PNIRef.release(index);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy