Re: NSRecursiveLock problems
Re: NSRecursiveLock problems
- Subject: Re: NSRecursiveLock problems
- From: PCWiz <email@hidden>
- Date: Tue, 22 Dec 2009 12:49:22 -0700
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 (email@hidden)
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:
This email sent to email@hidden