返回

static inline voidrwlock_rlock(struct rwlock *lock) { for (;;) { while(lock->write) { __sync_synchronize(); } __sync_add_and_fetch(&lock->read,1); if (lock->write) { __sync_sub_and_fetch(&lock->read,1); } else { break; } }}

中while(lock->write) { __sync_synchronize(); }这段应该可以不要把

__sync_add_and_fetch(&lock->read,1); 已经有acquire语义了, 云风大哥能解释下吗

名字: 自动排版 密码:

回复 | (2585) | ctx | 2012-09-07 06:14:36