Re: Cocoa threading, objects by reference, and the keyword "oneway"
Re: Cocoa threading, objects by reference, and the keyword "oneway"
- Subject: Re: Cocoa threading, objects by reference, and the keyword "oneway"
- From: Andreas Doerr <email@hidden>
- Date: Wed, 06 Jun 2001 14:19:29 +0200
- Organization: Working Objects GmbH
Hi Miguel,
>
What I want to do is transfer an object from one thread to another, but
>
only using it's reference
*snip*
>
(oneway void)sendMap: (in SkyMapClass**) SkyMapReference
>
{
>
SkyMapClass *newSkyMap;
>
>
newSkyMap = *SkyMapReference;
>
>
[newSkyMap doSomething];
>
>
... Send it on to the next thread in exactly the same way...
>
}
>
>
Now if I remove the keyword oneway from the method definition, it works,
>
but of course defeats the parallel processing that I'm trying to do.
I don't understand, why you are using the 'oneway' keyword at all! This keyword
is used in the context of remote messaging. If you want to pass a reference
between to threads (which share the same address space) why don't you just pass
it? Of course, you have to synchronize access to this memory location.
If you *really* want to use remote messaging you can't simply pass a pointer
from one process to a remote object in a different process. The pointer will be
automatically dereferenced by the run-time system. For large chunks of memory,
use shared memory in this case.
I also don't understand why you are using several threads at all. Your
processing seems to be strictly sequential ...
Regards,
--Andreas