Re: How to make DO not do transformations
Re: How to make DO not do transformations
- Subject: Re: How to make DO not do transformations
- From: Robert Goldsmith <email@hidden>
- Date: Tue, 24 Sep 2002 21:35:01 +0100
On Tuesday, September 24, 2002, at 07:27 pm, Mike Laster wrote:
>
Is there a clean way to make DO not do any transformations to the
>
arguments? This is DO between threads, not between
>
processes or hosts.
>
>
If I have a method:
>
>
- (void) doSomethingWithObject:(NSObject *)anObject;
>
>
The default behavior is for the recevier to get an NSProxy that refers
>
to anObject.
>
>
I can make a protocol and specify 'bycopy' to make the receiver
>
receive a real object instead of a proxy, but it's still a different
>
object.
By 'new object' I assume you mean it is a new instance created, not one
with the same internal state as your original. What exactly are you
trying to do? Without using a proxy there is no real way to synchronise
two objects in two different threads so I guess you have an object in
the first thread that you no longer need in the first thread but do
want to use in the second thread. I can suggest three options. First,
create an NSData from it and copy across the NSData. Second, serialise
it and deserialise it the other side or third, create the proxy then
copy it. This should copy the original, not the proxy object. I suspect
option one is the fastest but the most hacked. When you have done this
copy / whatever, you simply release the original. Note that using
method 1, you don't need to retain at the other end as it still has the
reference count of the original - this is partly why it is the biggest
hack.
Anyone see anything wrong with any of this?
Robert
---
GnuPG public key:
http://www.Far-Blue.co.uk/RSGoldsmith.asc
[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
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.