• 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: Thread Safe APIs?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread Safe APIs?


  • Subject: Re: Thread Safe APIs?
  • From: Esteban <email@hidden>
  • Date: Tue, 26 Jun 2001 20:13:57 -0700

I'm not sure if there's a official and full list of thread safe Cocoa APIs, but I remember reading something about it not being a good idea to call AppKit APIs directly in a multithreaded app. For example, you can't modify an NSTextField directly from a secondary thread in your app. Instead you should have a function in your primary thread that handles and distributes the request.

The idea is that a secondary thread puts in a request to call the method that will update the NSTextField to the NSRunLoop in the main thread. When the main thread is done with whatever it was doing it will see the request and call things to be updated appropriately.

At least this is what I understood from the TrivialThreads and SimpleThreads examples at Apple's site. It is also how I'm handling updating of any elements in my own multithreaded application.

Also I think that all of the Foundation APIs are thread-safe.

-Esteban

On Tuesday, June 26, 2001, at 03:43 PM, Steve Gehrman wrote:

Is there a list of thread safe Cocoa APIs? I'm trying to write a multithreaded app and am getting mysterious random crashes. I wish there was an easier way to figure out what I'm calling that I shouldn't be calling.

steve
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Thread Safe APIs? (From: Steve Gehrman <email@hidden>)

  • Prev by Date: Oddities in Cocoa/Java object initialization?
  • Next by Date: Re: Library loading policy on Mac OS X with Cocoa
  • Previous by thread: Thread Safe APIs?
  • Next by thread: Re: Thread Safe APIs?
  • Index(es):
    • Date
    • Thread