Skip to content
Snippets Groups Projects
Commit 95722c1b authored by Florian Fischer's avatar Florian Fischer
Browse files

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.
parent 29dafcb3
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment