• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSRecursiveLock problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSRecursiveLock problems


  • Subject: Re: NSRecursiveLock problems
  • From: PCWiz <email@hidden>
  • Date: Wed, 23 Dec 2009 12:08:56 -0700

It all seems to be stable now, so turning off background layout worked :-)

Thanks

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


On 2009-12-23, at 9:45 AM, Douglas Davidson wrote:

>
> On Dec 22, 2009, at 6:07 PM, PCWiz wrote:
>
>> The issue class in my case is NSLayoutManager. I dug through the docs for NSLayoutManager and read the section on thread safety. There were 2 steps to achieving thread safety with NSLayoutManager. First, if the NSLayoutManager belonged to an NSTextView, then the text view must not be displayed while a secondary thread is making changes using its layout manager. The second part was to turn off background layout for the NSLayoutManager.
>>
>> In my case the layout manager was not tied to a text view (I was just using it to get the size of an attributed string) so all I had to do was this:
>>
>> [layoutManager setBackgroundLayoutEnabled:NO];
>
> Those are the two criteria I specified in the release notes as being essential for using NSLayoutManager on a background thread.  In general, an NSLayoutManager and associated objects can be used from only a single thread at once, but as long as you have eliminated simultaneous accesses to them from other threads, they should be OK.  The tricky part is that view display and background layout will happen automatically on the main thread, so you need to make sure those will not occur for your layout manager while you are using it on a background thread.  If you have done that and still see threading issues, please file a bug.
>
> Douglas Davidson
>

_______________________________________________

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

References: 
 >Re: NSRecursiveLock problems (From: Greg Guerin <email@hidden>)
 >Re: NSRecursiveLock problems (From: PCWiz <email@hidden>)
 >Re: NSRecursiveLock problems (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Releasing Objects
  • Next by Date: Re: Are views active or inactive?
  • Previous by thread: Re: NSRecursiveLock problems
  • Next by thread: Re: NSRecursiveLock problems
  • Index(es):
    • Date
    • Thread