Re: Running an NSTask Within an NSThread
Re: Running an NSTask Within an NSThread
- Subject: Re: Running an NSTask Within an NSThread
- From: Quincey Morris <email@hidden>
- Date: Sun, 27 Jan 2008 15:18:20 -0800
On Jan 27, 2008, at 14:06, Jonathan Dann wrote:
// NSDocument subclass implementation
- (IBAction)runTask:(id)sender;
{
TaskController *tC = [[TaskController
defaultControllerForDocument:self];
[tC performTask];
}
// TaskController.m
+ (TaskController *)defaultController;
{
TaskController *controller = [[self alloc] init];
return [controller autorelease];
}
It occurs to me, based solely on the code you posted, that there's
really no need for a TaskController at all. Why isn't your document
subclass itself the task controller? It's as much work to make the
document subclass keep track of the TaskController as it is to make
the document subclass keep track of the NSTask directly (if not more).
The only reason for a separate TaskController would be if it had to
run in a separate thread, which you were talking about earlier. But
everything that you show TaskController doing looks like it would work
fine in the main thread.
_______________________________________________
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