ios - Which tasks are more suitable to NSOperation than GCD? -
this question has answer here:
- nsoperation vs grand central dispatch 8 answers
which tasks better suited using nsoperation opposed using gcd when programming iphone?
to me seem same thing. can't see strengths , weaknesses 1 has on other.
nsoperation built on top of gcd, question more whether use nsoperation or pass block directly gcd.
an nsoperation bulky , needs more boiler-plate codes set up, has lot more functionality. can create same nsoperation subclass in various parts of code , put them queue , run it.
passing block gcd e.g. dispatch_async quick , disposable. typically don't reuse block anywhere else; set block executed @ point of code, passes gcd or other apis, , go on.
so each has merits.
Comments
Post a Comment