Re: Setting up an auxiliary task for use with Distributed Objects
Re: Setting up an auxiliary task for use with Distributed Objects
- Subject: Re: Setting up an auxiliary task for use with Distributed Objects
- From: "Jeremy W. Sherman" <email@hidden>
- Date: Thu, 16 Apr 2009 09:27:02 -0400
On Thu, Apr 16, 2009 at 5:01 AM, Oleg Krupnov <email@hidden> wrote:
> I'm looking for the right way of setting up the auxiliary NSTask from
> within the main task. The aux task vends some Distributed Objects, and
> the main task uses them.
>
> The auxiliary task does this:
>
> NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
>
> MyVendedObject* vendedObj = [[[MyVendedObject alloc] init] autorelease];
>
> NSConnection* connection = [NSConnection defaultConnection];
> [connection setRootObject:vendedObj];
> if ([connection registerName:@"MyAuxTask"])
> {
> [[NSRunLoop currentRunLoop] run];
> }
>
> [pool release];
> return 0;
>
> As I understand, as soon as the aux tasks reaches the runloop's run
> message, it blocks and is ready for connection messages.
>
> However there are 2 problems:
>
> 1) I need to block the main task until the aux task is ready to work.
> How do I do it? Sleep/poll connection/repeat doesn't seem a good
> approach, is there any better way?
>
> 2) How do I quit the aux task? [NSTask terminate] does not work,
> invalidating the connection does not work...
> _______________________________________________
>
> 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
>
_______________________________________________
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