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

Function test_single_timeout_exit

test/timeout.c:494–520  ·  view source on GitHub ↗

* Test that timeout is canceled on exit */

Source from the content-addressed store, hash-verified

492 * Test that timeout is canceled on exit
493 */
494static int test_single_timeout_exit(struct io_uring *ring)
495{
496 struct io_uring_sqe *sqe;
497 struct __kernel_timespec ts;
498 int ret;
499
500 sqe = io_uring_get_sqe(ring);
501 if (!sqe) {
502 fprintf(stderr, "%s: get sqe failed\n", __FUNCTION__);
503 goto err;
504 }
505
506 msec_to_ts(&ts, 30000);
507 io_uring_prep_timeout(sqe, &ts, 0, 0);
508
509 ret = io_uring_submit(ring);
510 if (ret <= 0) {
511 fprintf(stderr, "%s: sqe submit failed: %d\n", __FUNCTION__, ret);
512 goto err;
513 }
514
515 io_uring_queue_exit(ring);
516 return 0;
517err:
518 io_uring_queue_exit(ring);
519 return 1;
520}
521
522/*
523 * Test multi timeouts waking us up

Callers 1

mainFunction · 0.85

Calls 4

io_uring_submitFunction · 0.85
io_uring_queue_exitFunction · 0.85
msec_to_tsFunction · 0.70
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected