Re: remote proxy object somehow not correct
Re: remote proxy object somehow not correct
- Subject: Re: remote proxy object somehow not correct
- From: "Adam R. Maxwell" <email@hidden>
- Date: Mon, 15 Jan 2007 20:39:55 -0800
On Jan 15, 2007, at 19:59, William Zumwalt wrote:
I took this example from the documentation on DO's and this is almost
exactly what they have in there. And I do reverse the ports when they
are put into the NSArray. I think you can seem them in the first post
in the +startNetworkThreadWithTag method. I just add them to the array
in backwards order.
Sorry, I did indeed read that incorrectly.
I think you want to reverse these ports. You may also have some
memory management issues to work out, since
+startNetworkThreadWithTag
returns a retained instance.
I'm just trying to call a method on the main thread so I can pass the
thread instance to it for later use, but it doesn't call the main
threads setServer method at all. That's why I think there is something
wrong w/ the rootProxy object I've set up.
Looking at it again, I think your main thread is blocking on the
serverLock, and you'll have to unlock it before getting a connection
to the main thread. I tried something similar, thinking I could block
until the server thread's proxy was set up, but ran into the same
problem.
Generally, you should wrap -[NSConnection rootProxy] in an exception
handler and catch possible timeouts or other exceptions, as shown in
the documentation. It's not really clear what you're doing, other
than that. You're sending [[serverConnection rootProxy]
setServer:tag:] on your worker thread, and using class objects as
root
objects. This final line is equivalent to just doing [serverObject
setServer:serverObject tag:serverTag], which is probably not what you
want.
If you're just getting started with DO, I'd recommend trying a really
trivial example, since the documentation is pretty thin.
I am using the code in the "communication with distributed objects" on
this page, so my code should do what is listed there.
http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/index.html
Just be careful of all the things the examples in the documentation
leave out, like tearing down connections and ports, and dealing with
memory leaks. Also, make sure to study the DO docs at <http://developer.apple.com/documentation/Cocoa/Conceptual/DistrObjects/index.html
>. The design of the Multithreading example seems a bit odd to me
(I'm not used to thinking of it with class methods), but I'm obviously
not a DO expert, so take what I write with a grain of salt :).
regards,
Adam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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