On 11 Nov 2010, at 14:37, Andreas Grosam wrote: > >> You have to do a bit more management but you get the control you need. > IMHO, using NSOperation/NSOperationQueue is exactly what I consider a higher > level API. It has also additional cool features which give you even more > control where NSThread doesn't provide such things at all. So, for me in many > cases it's much more easier to use NSOperations than implementing the same > thing using NSThread. No doubt about it. NSOperation et al are very powerful
> >> >> Also NSOperation generated threads do not, IIRC, instantiate a run loop. > The thread executing an NSOperation scheduled from an NSOperationQueue > already has a run loop :) But of course you need to use it, see example below. What I meant of course was that you cannot access an NSOperation's thread and target it with the assumption that the run loop will be running. But then you cannot access the NSOperation thread in the first place! > >> If you want to message your thread using performSelector:onThread you will >> need a run loop. > In case you would like to do similar things when using NSOperation and > NSOperationQueue you might consider to send the message to the run loop > instead, e.g.: -performSelector:target:argument:order:modes: > > Of course you would need a mechanism to get the corresponding run loop for > that operation. I would suggest to define a property in your custom operation > and set it when the operation enters its main method. > That's a great idea that never occurred to me. I ended up not using NSOperation recently because I could not figure out how to schedule a method. Will definitely use this. Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com