• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >[aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE] (From: "devdrvr.net Multi-Platform SW" <email@hidden>)

  • Prev by Date: Re: [aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
  • Next by Date: problem with flagsChanged in a custom view
  • Previous by thread: Re: [aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
  • Next by thread: Re: [aTask setLaunchPath:@MYLOCALOBJECTIVECROUTINE]
  • Index(es):
    • Date
    • Thread