axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.86k stars 402 forks source link

How does io_uring_prep_timeout_remove know what to remove? #1243

Closed Oipo closed 1 month ago

Oipo commented 1 month ago

I'm having a hard time deciphering the io_uring_prep_timeout_remove man page.

If I create a new timer like so:

auto *sqe = io_uring_get_sqe(ring);
io_uring_sqe_set_data(sqe, new SomeInternalStructWithCallback{...});
io_uring_prep_timeout(sqe, &_timespec, 0, 0); //_timespec is some long-lived variable in my class

How do I then remove the timeout?

axboe commented 1 month ago

See the man page for io_uring_prep_cancel() and related helpers, you can cancel any request based on a number of criteria. You don't need to use timeout_remove helpers, though you can.

Oipo commented 1 month ago

Aaah, gotcha. Thanks!