Re: Need -[NSTask waitUntilExitOrTimeout:] (was NSTask "Thread Unsafe"...)
Re: Need -[NSTask waitUntilExitOrTimeout:] (was NSTask "Thread Unsafe"...)
- Subject: Re: Need -[NSTask waitUntilExitOrTimeout:] (was NSTask "Thread Unsafe"...)
- From: Jens Alfke <email@hidden>
- Date: Mon, 14 Sep 2009 20:51:31 -0700
On Sep 14, 2009, at 6:29 PM, Jerry Krinock wrote:
Uh, yeah, it took me a while to track that one down. Apparently,
running a run loop that is already running is not a good idea.
That's not generally true; there's definitely code that does this.
I've found that generally it helps to run the runloop in some
nonstandard mode, otherwise you can end up with weird re-entrancy
problems where some kind of event gets delivered during your loop and
triggers other handlers in your app. This might explain the NSUndo
problem you had.
I've got an NSTask wrapper in my MYUtilities library, which is being
used pretty heavily in my app Murky.
(I've definitely found NSTask to be difficult to use. It seems
straightforward enough, but if you want to use it in a nonblocking
way, and handle I/O redirection, it gets surprisingly tricky. It
really shouldn't take 400+ lines of code to implement MYTask, but
somehow it does...)
—Jens_______________________________________________
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