len3d

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

atomic:

if (num_pinned == 0 && ptr != 0)
{
    swap(ptr, 0);
}

struct {
    void *ptr;
    Intptr num_pinned;
};

p = ptr
if (p != NULL)
{
    e = [p 0x00000000]
    result = [NULL 0x00000000]
    if (CAS(&ptr, e, result))
    {
        free(result.high);
    }
}

posted on 2010-04-08 00:34  Len3d  阅读(198)  评论(3编辑  收藏  举报