Hi John,

On Wed, Jan 7, 2009 at 9:01 AM, John Love <....> wrote:
>       NSWorkspace  *workSpace = [NSWorkspace sharedWorkspace];

> Let me wrap this up by saying when myRoutine is called in my main thread,
> everything works fine .. but when called by my background thread (via
> [NSThread detachNewThreadSelector:toTarget:withObject:] it definitely does
> not work.

There was a discussion recently on Twitter of all places regarding the
thread safety of various Cocoa classes.  Thread safety includes
non-main thread usability, and it was determined that many Cocoa
classes aren't safe to use on non-main threads.  It's possible that
NSWorkspace falls into this category.  The solution for NSFileManager
was to alloc/init a new one on the thread[1], but I'm not sure if that
will work for NSWorkspace.  Otherwise you're forced to make all those
calls on the main thread.

Typically, if a class isn't documented as thread-safe, that implies it
is only main-thread safe as well.


Jason


[1] Tweet from Dave Dribin: http://twitter.com/ddribin/status/1097936172
_______________________________________________

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