-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] prevent races in task cancellation #38404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6790157
to
64f13ed
Compare
be19b86
to
5dec799
Compare
@swift-ci please smoke test |
Windows |
8d30552
to
9d5be78
Compare
9d5be78
to
e8888f7
Compare
@swift-ci please smoke test and merge |
void run(JobPriority newPriority) { | ||
Function(Argument, newPriority); | ||
} | ||
void run(JobPriority newPriority) { Function(Argument, newPriority); } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The formatting changes are by git-clang-format)
|
||
// else, the task was already cancelled, so while the record was added, | ||
// we must run it immediately here since no other task will trigger it. | ||
record->run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change™.
We used to do this in a racy way in Swift but have to do so in here, based on the return of addStatusRecord
It's a bit unfortunate that this PR has a ton of unrelated reformatting in it. |
Otherwise the fix looks good, thanks! |
Thanks for review!
Yeah... :| Perhaps I misused git-clang-format? Only discovered it this week to be honest heh; maybe I had applied it to the wrong commit...? I'll double check next time if it did the right thing, I kind of want it as a post-commit hook hmmm |
This fixes two kinds of races with withTaskCancellationHandler:
Many details inside the PR.
Resolves rdar://78177513