Which tasks are more suitable to NSOperation than GCD?

<>

This question already has an answer here:

Answers


NSOperation is built on top of GCD, so the question is more about whether you use NSOperation or pass a block directly to GCD.

An NSOperation is bulky and needs more boiler-plate codes to set it up, but it has a lot more functionality. You can create the same NSOperation subclass in various parts of your code and put them into the queue and run it.

Passing a block to GCD by e.g. dispatch_async is quick and disposable. You typically don't reuse a block anywhere else; you just set up a block which is executed only at that point of the code, passes it to the GCD or other APIs, and quickly go on.

So each has its merits.


Need Your Help

Convert Coin3D SoOffscreenRenderer to QImage and render with OpenGL

c++ qt opengl openinventor

I'm trying to display a Coin3D/Open Inventor scene with QT in a QGLWidget, by using the SoOffscreenRenderer and I need help converting it to a QImage

how to prevent event chaining in javascript

javascript jquery javascript-events

I have 4 icons that, on mouse over, scroll a div using jquery animate.