Re: NSConnection, where'd my proxy go?
Re: NSConnection, where'd my proxy go?
- Subject: Re: NSConnection, where'd my proxy go?
- From: Chris DeSalvo <email@hidden>
- Date: Mon, 10 Jun 2002 11:38:57 -0700
on 6/7/02 10:44 PM, Bill Bumgarner said:
>
If everything is running within a single application, there is no need to
>
register and advertise a named connection for intra-thread
>
communication. In the main thread:
>
>
... (applicationDidInitialize or some such early point) ...
>
threadReceivePort = [[NSPort port] retain]; //ivar
>
threadSendPort = [[NSPort port] retain]; // ivar
>
>
appkitConnection = [[NSConnection alloc]
>
initWithReceivePort:threadSendPort sendPort:threadReceivePort];
>
[appkitConnection setRootObject:self]; // self is -retain'd and won't
>
go away
>
....
>
>
The thread connects to the MEL thread by executing the following *in the
>
thread*:
>
>
....
>
serverConnection = [NSConnection
>
connectionWithReceivePort:threadReceivePort sendPort:threadSendPort];
>
appkitProxy = [[serverConnection rootProxy] retain];
>
>
[appkitProxy ...do stuff...];
>
....
I tried that. I get the NSConnection back ok. However, when I try to call
rootProxy: on it I get the following exception:
2002-06-10 11:36:02.955 D2 X[2962] *** Uncaught exception:
<NSObjectInaccessibleException> NSDistantObject accessed attempted from
another thread
No matter what I do I can't get the proxy for that connection. Here is some
more background. The worker thread is a pthread that is part of a big nasty
chunk of source that I have to share with several other platforms and apps
and can't easily modify.
Thanks,
Chris
_______________________________________________
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.