Re: DO, bycopy
Re: DO, bycopy
- Subject: Re: DO, bycopy
- From: John Hörnkvist <email@hidden>
- Date: Fri, 26 Oct 2001 00:03:38 +0200
On Thursday, October 25, 2001, at 11:51 PM, Miguel Morales wrote:
Dear all,
I have DO between 2 threads, and I'm having trouble getting the bycopy
keyword to work for my classes and not just the foundation classes.
Has anyone else seen this behavior, is there some magic handshake I
need to get this to work? The behavior is described below:
I have a program with DO where I am passing objects using the bycopy
keyword. This _should_ give me a new copy of the object in the new
thread, where I can manipulate the copy locally.
You have to implement this yourself in your custom subclasses; NSObject
doesn't handle it for you.
Look at NSPortCoder and classForPortCoder/replacementObjectForPortCoder.
- (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
{
if ([encoder isBycopy]) return self;
return [super replacementObjectForPortCoder:encoder];
}
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com
References: | |
| >DO, bycopy (From: Miguel Morales <email@hidden>) |