NSTask is "Thread Unsafe". What does that mean?
NSTask is "Thread Unsafe". What does that mean?
- Subject: NSTask is "Thread Unsafe". What does that mean?
- From: Jerry Krinock <email@hidden>
- Date: Mon, 14 Sep 2009 07:07:29 -0700
According to the Threading Programming Guide [1], NSTask is listed
under "Thread Unsafe Classes", which is explained as:
"The following classes and functions are generally not thread-safe.
In most cases, you can use these classes from any thread as long as
you use them from only one thread at a time. Check the class
documentation for additional details."
Let's take that apart:
* "In most cases". Probably wouldn't pass my QA. So I search the
NSTask class documentation for the word "thread" and find nothing.
* "use these classes from any thread". Not sure what they mean by
"use". I presume it means "send messages to the class object or
instances of the class from any thread". Am I correct?
Then, in the list archives I found this comment made just last year by
a well-respected Cocoa programmer and published author:
"I often spawn a new thread for my NSTasks because it makes them
easier to write. For instance, I can start an NSTask and then just
call [NSTask waitUntilExit]..."
and no one called him on it.
What does NSTask being "Thread Unsafe" mean to you?
Thanks,
Jerry Krinock
1. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html
2. http://www.cocoabuilder.com/archive/message/cocoa/2008/1/27/197397
_______________________________________________
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