Class Arenas

java.lang.Object
org.javagi.interop.Arenas

public class Arenas extends Object
Keeps a list of open Arenas that will be closed in a DestroyNotify callback. The DestroyNotify callback will know which Arena to close, based on the hashcode that is passed in the user_data parameter.
  • Field Details

    • CLOSE_CB_SYM

      public static final MemorySegment CLOSE_CB_SYM
      The upcall stub for the DestroyNotify callback method
  • Constructor Details

    • Arenas

      public Arenas()
  • Method Details

    • close_cb

      public static void close_cb(MemorySegment data)
      This is called by native code when it runs the DestroyNotify callback. It will close the accompanying Arena.
      Parameters:
      data - pointer to the hashcode of the Arena to close
    • cacheArena

      public static MemorySegment cacheArena(Arena arena)
      This will add the Arena to the global static list of open arenas, and return a pointer to the hashcode of the Arena.
      Parameters:
      arena - the Arena to cache
      Returns:
      a pointer to the hashcode of the Arena
    • readyToClose

      public static void readyToClose(Arena arena)
      Allow the upcall stub allocation of the callback to be released.
      Parameters:
      arena - the cached Arena