ios - How to block an NSOperation until an NSOperationQueue finishes? -


i have data loading operation needs run off main thread avoid potential blocking issues. this, use nsoperationqueue , nsoperations.

one issue has come up, however, 1 of operations exists spawn additional operations based on incoming information. trying solve solved minor issues had elsewhere, solution hit upon give nsoperation it's own queue sub-tasks.

the problem 'main' exits, nsoperation going marked 'finished', regardless of whether or not sub-queue finished processing; how override behavior?

you send waituntilalloperationsarefinished message child queue before exit operations main method. easy, not idea blocks whole thread rather wasteful.

a better solution use dependency system. create operation has dependency on main operation. after create child operations add them dependency new 'finishing' operation.


Comments

Popular posts from this blog

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -