NSConnection, where'd my proxy go?
NSConnection, where'd my proxy go?
- Subject: NSConnection, where'd my proxy go?
- From: Chris DeSalvo <email@hidden>
- Date: Fri, 07 Jun 2002 15:34:29 -0700
So I'm following everyone's suggestion and doing my multi-thread messaging
with distributed objects through NSConnection.
Everything seems to be fine, except my worker thread can't seem to, well,
make the connection.
My initial setup is happening in the main thread thusly:
threadReceivePort = [[NSPort port] retain];
threadSendPort = [[NSPort port] retain];
appkitConnection = [[NSConnection alloc]
initWithReceivePort:threadSendPort sendPort:threadReceivePort];
[appkitConnection registerName:@"D2_PROXY"];
[appkitConnection setRootObject:self];
Then in the worker thread I'm trying to make calls thusly:
conn = [NSConnection connectionWithRegisteredName:@"D2_PROXY" host:nil];
proxy = (D2Controller *) [conn rootProxy];
The connection is found, and conn is non-nil. However, proxy comes back
nil. I've tried about a million little tweaks for the ordering of things
and it just never works. Calling rootProxy always returns nil no matter
what I do.
Ugh, safely sending messages between threads shouldn't be this hard. I'm
also still amazed that after 15+ years of development all of the NextStep UI
frameworks aren't thread-safe.
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.