Closed sxstd001 closed 3 months ago
like this?
// read
while(true){
spinlock.lock();
if(fd != -1){
uring_prep_read(fd);
uring_submit(...)
}
spinlock.ulock();
...
}
// close
spinlock.lock();
if(fd != -1){
uring_prep_close(fd);
uring_submit(...)
fd=-1;
}
spinlock.unlock();
// write
while(true){
spinlock.lock();
if(fd != -1){
uring_prep_write(fd);
using_submit(...);
}
spinlock.ulock();
...
}
That would be quite a bother, can't you just dup the file and make your life much easier? Hard to tell more without knowing if it's different rings, if it's using fixed files and so on.
threadA read, threadB write. if threadA close(fd). This synchronization is difficult to implement simply; This is far more complex than EPOLL.