Closed richard0326 closed 1 month ago
I'm checking if 'io-uring func' is thread safe
I'm checking if 'io-uring func' is thread safe
liburing func
is not thread safe, io-uring func
is. That means, you must use syscalls ( io_uring_setup, io_uring_enter ... ) with io_uring fd directly
Hello I'm trying to use IO_uring and not used to it I have tried all the echo severs of every open sources. So I know the basic uses.
This is my problem! This is what I have tried and doesn't work!!
= what I have done = I have a cqe loop thread. I call it "CompleteIOThread". And have another thread. Call it "SubmitThread".
I will wait some cqes in my CompleteIOThread by using 'io_uring_wait_cqe' or some kind. And after cqe comes, and thread will start. I will solve with cqe (use 'io_uring_cqe_seen') and make another sqe but not in this thread. I will toss some cqe result to SubmitThread and SubmitThread will do some logics and then use sqe.
something like this (code in SubmitThread) " struct io_uring_sqe *sqe = io_uring_get_sqe(_ring); if (sqe == nullptr) { cerr << "Warning Fail\n"; } else { io_uring_prep_read(sqe, _fd, _buffer, _bufferSize, 0); io_uring_submit(_ring); } " 2 thread has same ring. And Submit thread can be scale out! or Opersite(CompleteIOThread can be scale out)
Is it not posible to use 'io_uring func' in different thread?? Because it keep returning nullptr in sqe and I have no idea to look!