On Feb 4, 2009, at 3:25 PM, Oleg Krupnov wrote:

So the problem is solved for now, but one question still left open for
the future is the following: would it be thread-safe to use NSTask in
the way I originally attempted? If yes, why did it leak? The leak was
reported somewhere inside NSTask internal initialization code. Funny
enough, the leak disappeared if I made one superfluous -release call
on NSTask.

No, the NSTask class itself (at least up to 10.4) should only be used from the main thread, particularly if you're spawning multiple tasks at the same time from different threads. I suspect this is due to a race condition in how it's notified of child exit, and it appears to have changed in 10.5.

I wrote my own subclass to get around this, since a user finally had a reproducible bug report. It's BSD licensed, if anyone's interested: http://bibdesk.svn.sourceforge.net/viewvc/bibdesk/trunk/bibdesk/BDSKTask.m?view=markup

--
Adam

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

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to