On Sep 14, 2009, at 7:07 AM, Jerry Krinock wrote:

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."

[...]

What does NSTask being "Thread Unsafe" mean to you?

Ordinarily, I'd guess that it's supposed to mean that you can't share instances between threads. However, guesswork when dealing with the threading docs drives me crazy.

For NSTask in particular, I recommend that you interpret that more conservatively, since (at least prior to 10.5) there's a subtle race condition in the implementation that causes some really nasty problems when you try to spawn tasks from multiple threads simultaneously. Things may or may not be fixed in 10.5 and 10.6, and whether you run into it also depends on your hardware and the number of tasks you use. Over several years, we had multiple reports of the problem, but only one user was able to reproduce it consistently. I wrote an implementation of NSTask from scratch to work around the problem.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to