dreamlike-ocean / PanamaUring

使用panama api为java提供io_uring的绑定而无需使用jni绑定,同时统一文件IO和网络IO的模型,提供一套易用的异步IO API
MIT License
77 stars 12 forks source link

Hello, I have also worked on a similar thing #1

Closed GavinRay97 closed 1 year ago

GavinRay97 commented 1 year ago

I found your repo searching GitHub for io_uring API calls

It seems we are interested in similar things -- I also have started experimenting with io_uring bindings using Panama I looked at your code, maybe my code also is helpful for you? 🙂

    @Test
    void testReadAndPrintFile() throws Throwable {
        MemorySegment ring = session.allocate(io_uring.$LAYOUT());
        int ret = liburing.io_uring_queue_init(8, ring, 0);
        if (ret < 0) {
            System.out.printf("queue_init: %d", ret);
            return;
        }

        ret = IoUringExample.submit_read_request("src/test/resources/test.txt", ring.address());
        if (ret < 0) {
            System.out.printf("submit_read_request: %d", ret);
            return;
        }

        IoUringExample.get_completion_and_print(ring.address());
    }
dreamlike-ocean commented 1 year ago

thx