设为首页 加入收藏

TOP

Linux内核通用链表 <linux/list.h>阅读(二)
2015-02-02 19:43:57 来源: 作者: 【 】 浏览:33
Tags:Linux 内核 通用 < linux/list.h> 阅读
t);
}


/**
* list_add_tail_rcu - add a new entry to rcu-protected list
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*
* The caller must take whatever precautions are necessary
* (such as holding appropriate locks) to avoid racing
* with another list-mutation primitive, such as list_add_tail_rcu()
* or list_del_rcu(), running on this same list.
* However, it is perfectly legal to run concurrently with
* the _rcu list-traversal primitives, such as
* list_for_each_entry_rcu().
*/
static inline void list_add_tail_rcu(struct list_head *new,
????? struct list_head *head)
{
__list_add_rcu(new, head->prev, head);
}


/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/


看不懂此函数可以看下面就明白了,删除已知节点,需要知道节点的后继和前趋
static inline void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
}


/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty on entry does not return true after this, the entry is
* in an undefined state.
*/
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = LIST_POISON1;
entry->prev = LIST_POISON2;
}


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Objective-C适用C数学函数 <ma.. 下一篇Linux C语言编程错误解决之 “war..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: