Well what I meant by delegates and selectors was like the secondary thread 
calls a selector on the main thread (using performSelectorOnMainThread) but I 
guess I got a little confused there :)

I would like to use blocks, however I'm using the 10.5 SDK so as far as I know 
blocks cannot be used. Is there a way to get performSelectorOnMainThread to 
return a value? That would solve my issue, because I could pass on the 
NSAttributedString to a method on the main thread that figures out the size and 
all, then returns the value.

Independent Cocoa Developer, Macatomy Software
http://macatomy.com


On 2009-12-22, at 12:22 PM, Bill Bumgarner wrote:

> 
> On Dec 22, 2009, at 11:19 AM, PCWiz wrote:
> 
>> Is there any easy way to execute a portion of code on the main thread 
>> without going through the mess of delegates and selectors?
> 
> 
> Delegates have *nothing* to do with main thread execution.   Selectors a bit 
> orthogonal, too.
> 
> If you want to execute something on the main thread, I would suggest using 
> NSOperationQueue's notion of main queue and enqueuing an operation with a 
> block:
> 
> - (void)addOperationWithBlock:(void (^)(void))block
> 
> Quite straightforward.
> 
> b.bum

_______________________________________________

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

Reply via email to