multithreading - Objective C - performSelectorInBackground V.S detachNewThreadSelector? -


both detachnewthreadselector , performselectorinbackground used call method in background.

is there difference between 2 methods? or both work same way?

they're both same different paradigms. behind scenes same thing. real difference -[performselectorinbackground:withobject:] follows other performselector style methods in they're defined on nsobject , message defines selector wish perform.

in general, should never have call either of these methods. favor using grand central dispatch or nsoperation , nsoperationqueue factor out expensive operations on other threads. both gcd , nsoperation classes give memory management, thread pool management , many other things you'll miss using older style dispatch methods.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -