MCPcopy Create free account
hub / github.com/axboe/liburing / completion

Function completion

examples/napi-busy-poll-server.c:221–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221static void completion(struct ctx *ctx, struct io_uring_cqe *cqe)
222{
223 char type;
224 int fd;
225 int res = cqe->res;
226
227 decodeUserData(cqe->user_data, &type, &fd);
228 if (res < 0) {
229 fprintf(stderr, "unexpected %s failure: (%d) %s\n",
230 opTypeToStr(type), -res, strerror(-res));
231 abort();
232 }
233
234 switch (type) {
235 case IOURING_SENDMSG:
236 receivePing(ctx);
237 --ctx->num_pings;
238 break;
239 case IOURING_RECVMSG:
240 ctx->iov.iov_len = res;
241 sendPing(ctx);
242 if (!ctx->napi_check)
243 reportNapi(ctx);
244 break;
245 default:
246 fprintf(stderr, "unexpected %s completion\n",
247 opTypeToStr(type));
248 abort();
249 break;
250 }
251}
252
253int main(int argc, char *argv[])
254{

Callers 1

mainFunction · 0.70

Calls 5

decodeUserDataFunction · 0.70
opTypeToStrFunction · 0.70
receivePingFunction · 0.70
sendPingFunction · 0.70
reportNapiFunction · 0.70

Tested by

no test coverage detected