-
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
Completed set before the task has actually completed #58
Comments
I'm not sure I understand, Continuations may run after waitUntilFinished has returned, but those are for following tasks and not the current task so I see no issue there. |
In this specific case, I expected the execution block to be called before [BFTask waitUntilFinished] returned which isn't the case. I expect this as I need to use the results of that block immediately after the call to [BFTask waitUntilFinished] on the same thread. Continuations do continue for other tasks within the queue, thats fine and as expected, but this refers to the specific task being waited on. |
If you do something like:
then when What you need is to do use the task returned from
then |
Ok, thats useful to know. The behaviour of my initial structure still seems incorrect though, but maybe that's just a documentation issues. I say that because I have the same code paths for both async and (for testing) synchronous calls with an optional call to [task waitUntilCompletion], which to me made the most sense. But like I say, maybe it just needs to be documented. |
Thanks guys! |
[BFTask waitUntilFinished] shows this quite clearly. Fire off a few tasks, then call waitUntilFinished. The call to wait... will continue (and the task will be set to completed) before the execution block has been called.
This is due to [self runContinuations] always being called after completed/cancelled etc. being set. As a result.
I'm wondering if this is due to thread contention if the was called on the same thread as the executor block, but at the moment the behaviour seems incorrect and results in a lot of additional checks to make sure the task has actually finished.
The text was updated successfully, but these errors were encountered: