Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running an NSTask Within an NSThread



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Running an NSTask Within an NSThread (From: Jonathan Dann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.