- 论坛徽章:
- 11
|
zhouzhenghui 发表于 2013-08-21 19:54 ![]()
,并且循环反复重试场景下的才工作的实现,跟真正意义上的无锁相差甚远 ...
这是你的代码
void lognode_put(struct lognode* node)
{
struct lognode* last;
struct lognode* before;
do {
last = tail;
if (last == &end) {
__sync_val_compare_and_swap(&tail, last, head);
continue;
}
before = __sync_val_compare_and_swap(&(last->next), NULL, node);
if (before != NULL)
__sync_val_compare_and_swap(&tail, last, before);
} while (before != NULL);
__sync_val_compare_and_swap(&tail, last, node);
}
你解释解释什么叫 循环反复重试场景下的才工作, 你的循环怎么就不是了 循环反复重试场景下的才工作
还有, 链表接口你也在吐槽, 链表接口又怎么了? 还有那个明明有数据读不出来的说法, 也还没解释呢 |
|