I don't think so. `async_terminate()` is currently no-op if the async has already been terminated with a status other than `STATUS_ALERTED`, and the patch maintains this invariant.
Right, that's the bit I failed to think through.
It is possible to introduce a new boolean flag, but the flag cannot replace `terminate_status`. `terminate_status` can be any arbitrary value passed to the third parameter of `async_set_timeout`.
Ah, and I missed that that was a possibility, although, in my defense, it's not stated in the patch subject either. I.e. this patch doesn't just fix the race where an alerted async is canceled, it also fixes the similar race where it times out.
So yes, I think the patch makes sense as is. Maybe a comment to yet again overdocument asyncs wouldn't hurt? I easily see myself looking at code like this and having to ask myself, "when exactly is terminate_status set?" and the answer is "if (and only if?) the async is canceled or times out while it's alerted", which is nice to have documented and not have to puzzle through later.