Re: NSRecursiveLock problems
Re: NSRecursiveLock problems
- Subject: Re: NSRecursiveLock problems
- From: PCWiz <email@hidden>
- Date: Tue, 22 Dec 2009 12:19:28 -0700
Yeah sounds like the exact same problem I'm having. The problems aren't consistent at all, it just happens once every few thousand strings.
Is there any easy way to execute a portion of code on the main thread without going through the mess of delegates and selectors?
Independent Cocoa Developer, Macatomy Software
http://macatomy.com
On 2009-12-22, at 12:06 PM, Chris Backas wrote:
> Hello,
>
> NSAttributedString has proven to be unsafe in many ways for use on a secondary thread in our own applications. We were trying to do much the same thing, get the size of a string from it. But it turns out (obviously in retrospect) that it needs to use the font/GUI systems to do this, which don't seem to be safe for use on secondary threads.
>
> My guess is that it's accessing locks in the Layout manager that aren't intended to be accessed from the non-main thread and causing this error. Unless someone else has more insight than I do, you'll have to come up with an alternative way to architect this - we had to do all our string measuring on the main thread. (We were actually getting occasional crashes from doing this on a secondary thread, maybe once every 30K strings or so)
>
> Hope that helps some,
> Chris Backas
_______________________________________________
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