• 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: NSUserDefaults & thread safety
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults & thread safety


  • Subject: Re: NSUserDefaults & thread safety
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Wed, 25 Jan 2006 07:54:24 -0800


On Jan 25, 2006, at 04:22, Derrick Bass wrote:

On Jan 25, 2006, at 5:47 AM, Jonathan del Strother wrote:

According to the documentation, NSUserDefaults isn't thread safe. Does this mean that any access to NSUserDefaults outside of the main thread is a really bad idea, or am I safe to restrict write- access to the main thread and let any thread have read-access?

See this message: <http://www.cocoabuilder.com/archive/message/cocoa/ 2005/8/11/144082>, which indicates that you can probably ignore the caution-badged warning in the NSUserDefaults API documentation.


In general "not thread safe" means that it is okay to use from different threads, as long as you make to sure to use some sort of synchronization so only one thread at a time is accessing the resource.

I'd say that this generalization could cause you a lot of grief.

Adam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSUserDefaults & thread safety
      • From: Jonathan del Strother <email@hidden>
References: 
 >NSUserDefaults & thread safety (From: Jonathan del Strother <email@hidden>)
 >Re: NSUserDefaults & thread safety (From: Derrick Bass <email@hidden>)

  • Prev by Date: Re: NSView setFrameSize
  • Next by Date: @synchronized produces warning on messages to super
  • Previous by thread: Re: NSUserDefaults & thread safety
  • Next by thread: Re: NSUserDefaults & thread safety
  • Index(es):
    • Date
    • Thread