The following is the implement of task_tracker::cancel_outstanding_tasks.
In the for loop, if i iterates to 2, take out the task of the second bucket queue head, which corresponds to task2 of the _outstanding_tasks[2]. next, and find that the status of task2 is running, and then execute task2->cancel (true). We will synchronize and wait for task2 to finish executing. The subsequent execution of task2 will generate a new task1, which corresponds to the same tracker as task2, but the bucket corresponding to task1 is 1. Because the for loop has already been executed to i=2, we will not go back to check for i=1, resulting in task1 tracked by the same tracker still being executed even after canel_standing_tasks have been executed.
Bug Report
The following is the implement of task_tracker::cancel_outstanding_tasks.
In the for loop, if i iterates to 2, take out the task of the second bucket queue head, which corresponds to task2 of the _outstanding_tasks[2]. next, and find that the status of task2 is running, and then execute task2->cancel (true). We will synchronize and wait for task2 to finish executing. The subsequent execution of task2 will generate a new task1, which corresponds to the same tracker as task2, but the bucket corresponding to task1 is 1. Because the for loop has already been executed to i=2, we will not go back to check for i=1, resulting in task1 tracked by the same tracker still being executed even after canel_standing_tasks have been executed.