FROM : Jim Correia
DATE : Sun Jan 06 20:32:14 2008
On Jan 5, 2008, at 9:16 PM, Bill Bumgarner wrote:
> I should add, though, that the above is not really atomic (and, of
> course, "atomic" is not thread safe -- merely non-crashy in the
> face of the threads).
>
> (One of the advantages of GC is that simple setters like the above
> become atomic in that assignments are atomic for object types.)
Can you offer any advice for the times when I must write my own
accessor, but want it to have similar behaviors to the autogenerated
accessor? In particular, I'm thinking about the default atomic
behavior. Is this simply wrapping the work in a @synchronized(self)
block? Something else?
I'd look in the objc-2 sources, but they aren't available yet :-)
Jim
DATE : Sun Jan 06 20:32:14 2008
On Jan 5, 2008, at 9:16 PM, Bill Bumgarner wrote:
> I should add, though, that the above is not really atomic (and, of
> course, "atomic" is not thread safe -- merely non-crashy in the
> face of the threads).
>
> (One of the advantages of GC is that simple setters like the above
> become atomic in that assignments are atomic for object types.)
Can you offer any advice for the times when I must write my own
accessor, but want it to have similar behaviors to the autogenerated
accessor? In particular, I'm thinking about the default atomic
behavior. Is this simply wrapping the work in a @synchronized(self)
block? Something else?
I'd look in the objc-2 sources, but they aren't available yet :-)
Jim






Cocoa mail archive

