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: Mike Laster <email@hidden>
- Date: Tue, 24 Sep 2002 17:00:47 -0400
On Tuesday, September 24, 2002, at 04:35 PM, Robert Goldsmith wrote:
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?
I'm actually wanting to hand-off responsibility of the object from one
thread to another. The object in this case is a network response
message (not using DO for networking). There's no need to synchronize
it. I'm trying to avoid unnecessary memory copies to try to make
things faster. I have all networking going on in a dedicated thread,
but client requests come in from another thread. I'm trying to hand
off the response message that was received to the caller's thread. As
soon as I do this, the network thread doesn't care about it anymore, so
there's no need for synchronization. Technically the copy behavior
does work, but
I can't seem to get better than 30 messages/second with that
implementation.
_______________________________________________
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.