Re: Thread Safe APIs?
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