Re: [aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
Re: [aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
- Subject: Re: [aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
- From: Shawn Erickson <email@hidden>
- Date: Sat, 12 Oct 2002 18:58:18 -0700
On Saturday, October 12, 2002, at 06:28 PM, devdrvr.net Multi-Platform
SW wrote:
>
Want to launch a local routine in my code with an
>
NSTask. Perhaps this is a complete misuse of the
>
class. Has anyone changed setLaunchPath to fire
>
up a local method or external C++ method call?
>
>
aTask = [[NSTask alloc] init];
>
>
// Instead of:
>
// [aTask setLaunchPath:@"/bin/ls"];
>
>
// Want to:
>
[aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
>
>
[aTask setArguments:nil];
Does it have to be a completely separate task? I don't think that is
what you want.
Try NSThread instead and use NSThread's
detachNewThreadSelector:toTarget:withObject: method. Based on your goal
to have a method in the triggering class called by a secondary thread I
would do something like...
- (void)someMethod
{
...
[NSThread detachNewThreadSelector:@selector(methodToCallFromThread)
toTarget:self
withObject:nil];
...
}
- (void)methodToCallFromThread
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//DO YOU WORK HERE
[pool release];
}
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.