Skip to content
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

Fixes coalesce operation race condition #24

Merged
merged 2 commits into from
Sep 9, 2019

Conversation

zhongwuzw
Copy link
Contributor

Even though _identifierToOperations is a weak-weak map, we still need to remove it when we removed operation. Otherwise, it may exists race condition which leads new added completion not be called for example.

A case:
Let's assume L384 and L213 runs concurrently, L384 executes firstly, then L213 executes, new added completion would not be called anymore.
https://github.com/zhongwuzw/PINOperation/blob/eed328e43f706fa9e4b2cc38e7ed1ba83dbb1c8c/Source/PINOperationQueue.m#L384

https://github.com/zhongwuzw/PINOperation/blob/eed328e43f706fa9e4b2cc38e7ed1ba83dbb1c8c/Source/PINOperationQueue.m#L213

Copy link
Collaborator

@garrettmoon garrettmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Change looks good to me!

@garrettmoon
Copy link
Collaborator

Do you mind rebasing against master for the new GitHub CI?

* Add basic github ci configuration

* Only build master / release branches on push
@zhongwuzw
Copy link
Contributor Author

@garrettmoon Done.

@garrettmoon garrettmoon merged commit 8730a96 into pinterest:master Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants