Skip to content

properly cancel future callbacks

Currently canceling Futures would never happen because we issued the cancel request only with the pointer of the future. This works more by coincidence than by design because the PointerTags::Future tagged onto the submitted future pointer is 0.

This does not work for callbacks because they are tagged with a PointerTags != 0 and they don't use their callback pointer rather than the future pointer.

Fix this by exporting the tagging from IoContext::prepareFutureChain into IoContext::createFutureTag and use this when submitting a cancel sqe.

Warn the user that they have to manually take care of the memory safety of the callback because we can not await the callback in Future::cancel.

Add a test case to CancelFutureTest.

Edited by Florian Fischer

Merge request reports

Loading