MCPcopy Create free account
hub / github.com/alibaba/async_simple / submitIO

Method submitIO

async_simple/executors/SimpleIOExecutor.h:110–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109public:
110 void submitIO([[maybe_unused]] int fd, [[maybe_unused]] iocb_cmd cmd,
111 [[maybe_unused]] void* buffer, [[maybe_unused]] size_t length,
112 [[maybe_unused]] off_t offset,
113 [[maybe_unused]] AIOCallback cbfn) override {
114#ifndef ASYNC_SIMPLE_HAS_NOT_AIO
115 iocb io;
116 memset(&io, 0, sizeof(iocb));
117 io.aio_fildes = fd;
118 io.aio_lio_opcode = cmd;
119 io.u.c.buf = buffer;
120 io.u.c.offset = offset;
121 io.u.c.nbytes = length;
122 io.data = new Task(cbfn);
123 struct iocb* iocbs[] = {&io};
124 auto r = io_submit(_ioContext, 1, iocbs);
125 if (r < 0) {
126 auto task = reinterpret_cast<Task*>(iocbs[0]->data);
127 io_event_t event;
128 event.res = r;
129 task->process(event);
130 delete task;
131 return;
132 }
133#endif
134 }
135 void submitIOV([[maybe_unused]] int fd, [[maybe_unused]] iocb_cmd cmd,
136 [[maybe_unused]] const iovec_t* iov,
137 [[maybe_unused]] size_t count, [[maybe_unused]] off_t offset,

Callers 3

TEST_FFunction · 0.80
Uthread_read_someFunction · 0.80
async_read_someFunction · 0.80

Calls 1

processMethod · 0.45

Tested by 1

TEST_FFunction · 0.64