0
我想保持一个理智,在一个伊娃,在一个根与他的血统共享块。结果值不用于兄弟姐妹,而是不同的对象谱系。标量是跨对象层次结构的同步对象的ivar?
@property (assign) NSUInteger ceil;
和作为
@synthesize ceil;
normaly合成而仅访问(用于更新),经由被合成其壳体对象:
- (NSUInteger)nextCeil
{
NSUInteger nextCeil = 0;
// The root (date) agenda keeps the master. When we fetch
// another ceil we clone it for our use as well. Later we
// can access this value in case we need to diagnose.
@synchronized (self)
{
// If we have a root go up there for value
if (root)
{
nextCeil = [root nextCeil];
}
else
{
nextCeil = ++ceil;
}
}
return nextCeil;
}
我的问题是,考虑到环境多线程是,这是安全/正确的?我迄今没有遇到任何问题。
设计历史是,这个根是其兄弟姐妹的核心,它有一个日期参考,根是以日为中心,而兄弟姐妹是以时间为中心。为了唯一性,每天需要一个计数器,分配给以时间为中心的对象,但不存储在那里。
是的,这是提供修改的唯一门,谢谢。 – slashlos