Distributed Obejcts

CharlyM

Registered
Hi Forum,

I have a questiton concerning distributet objects. I have created an application with two threads. The idea is that the main thread is responsible to do all the user interaction and that the spawned worker thread is responsible to do all the long blocking work like loading files etc which would block the GUI. I looked into the docs and found that the distributed objects concept is quite sexy.

Now I'm trying to understand what I'm doing. (What a silly idea). Well I think I got quite far. My understanding is that for every local object used by a message running in my main thread with the receiver being a remote object a NSDistantObject is created and linked to the appropriate NSConnection (running in the worker thread) and vise versa. So I always have a couple "real"-object and NSDistantObject stored in the NSConnection of the main thread and the switched couple stored in the NSCOnnection of the worker thread. To get this mechanism started the setRootObject is needed to tie an initial pair of "real"-object and NSDistantObject together. Actually I would be happy with this if this was it. Makes sence - every Object which was initialiy created on the other side is accessed via a NSDistantObject.

Now while I was debugging my program I found that also local variables which never were part of any remote method invokation only pretent being their declared type ([localObject className]). Actually they are of type NSDistantObject (gdb: p localObject->isa->name). So here is finally my question: why is this so? Shouldn't these local objects just be local objects? What happens when I access this local object? Where is it really stored at the end of the day? In which thread will the message be run with this local object as an receiver?

ok more than one question. But maybe someone can give the answer.

Thanks in advanced!
 
Back
Top