pinterest / PINOperation

Apache License 2.0
104 stars 48 forks source link

Fixes coalesce operation race condition #24

Closed zhongwuzw closed 5 years ago

zhongwuzw commented 5 years ago

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

garrettmoon commented 5 years ago

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

zhongwuzw commented 5 years ago

@garrettmoon Done.