-
Notifications
You must be signed in to change notification settings - Fork 576
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
Adds race task #229
Adds race task #229
Conversation
Wonderful! Yes, this is helpful for everyone, and is surfaced on Android as Will review code in detail in a little bit, but the first thing - can we rename it to |
|
@nlutsenko adding more tests, support for nullable array and rename the method |
Going to nitpick on stuff here, but will try my best to review the entire thing right now. |
@synchronized(lock) { | ||
[exceptions addObject:task.exception]; | ||
} | ||
}else if (task.error != nil) { |
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.
Nit: Space before else
.
Tried my best to review everything. There are few important pieces (usage of dispatch once predicate and constants instead of magic strings), but overall - it looks complete and nice. Discussion piece: |
for the cancellation token, I believe that can be problematic. It's heavily inspired by |
Cancellable by themselves - maybe, though I sort of can see a situation where you would want to have an ability to cancel the entire chain that ends with |
OSAtomicIncrement32Barrier(&cancelled); | ||
} | ||
|
||
if (task.completed && !task.faulted && !task.cancelled) { |
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.
I feel like you can unify this as else
statement on the above condition. Also, there is no way this task is not going to be completed here, since continueWithBlock:
is called only after it's completed.
}]; | ||
|
||
|
||
BFTask * task = [BFTask taskForCompletionOfAnyTask:@[first, second]]; |
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.
Nit: Remove space before task
.
Almost there. Few nits here and there and almost ready to go. |
@flovilmart updated the pull request. |
Adds a race task, been using that code in a category in production apps for a while.
Heavily inspired by the
taskForCompletionOfAll: