On Thu, Apr 16, 2009 at 5:01 AM, Oleg Krupnov <[email protected]> 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 protected])
>
> 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/jeremyw.sherman%40gmail.com
>
> This email sent to [email protected]
>
_______________________________________________

Cocoa-dev mailing list ([email protected])

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/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to