Class LibUring.CqFastPath

java.lang.Object
express.mvp.myra.transport.iouring.LibUring.CqFastPath
Enclosing class:
LibUring

public static final class LibUring.CqFastPath extends Object
Cached CQ accessors for hot-path polling.

LibUring.peekCqe(MemorySegment, MemorySegment) and LibUring.cqeSeen(MemorySegment, MemorySegment) are implemented in Java because liburing exposes them as static inline. The naive implementation recreates multiple MemorySegment views on every call.

This helper caches the stable CQ pointers (khead/ktail) and the CQEs array view so that the poll loop only allocates the per-CQE slice, significantly reducing allocation pressure and improving tail latency.

  • Method Details

    • peekHead

      public int peekHead()
      Returns:
      CQ head if CQE available, -1 if none
    • cqeUserData

      public long cqeUserData(int head)
    • cqeRes

      public int cqeRes(int head)
    • cqeFlags

      public int cqeFlags(int head)
    • peekCqe

      public int peekCqe(MemorySegment cqePtr)
      Returns:
      0 if CQE available, -EAGAIN if not
    • cqeSeen

      public void cqeSeen()
      Increment CQ head to mark the next CQE as consumed.
    • cqeSeen

      public void cqeSeen(int head)
      Increment CQ head using a previously read head value.