Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the implementation principle of qemu queue?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about the implementation principle of qemu queue, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

# define QLIST_HEAD (name, type)\

Struct name {\

Struct type * lh_first; / * first element * /\

}

# define QLIST_HEAD_INITIALIZER (head)\

{NULL}

# define QLIST_ENTRY (type)\

Struct {\

Struct type * le_next; / * next element * /\

Struct type * * le_prev; / * address of previous next element * /\

}

/ *

* List functions.

, /

# define QLIST_INIT (head) do {\

(head)-> lh_first = NULL;\

} while (/ * CONSTCOND*/0)

# define QLIST_INSERT_AFTER (listelm, elm, field) do {\

If (elm)-> field.le_next = (listelm)-> field.le_next)! = NULL)\

(listelm)-> field.le_next- > field.le_prev =\

& (elm)-> field.le_next;\

(listelm)-> field.le_next = (elm);\

(elm)-> field.le_prev = & (listelm)-> field.le_next;\

} while (/ * CONSTCOND*/0)

# define QLIST_INSERT_BEFORE (listelm, elm, field) do {\

(elm)-> field.le_prev = (listelm)-> field.le_prev;\

(elm)-> field.le_next = (listelm);\

* (listelm)-> field.le_prev = (elm);\

(listelm)-> field.le_prev = & (elm)-> field.le_next;\

} while (/ * CONSTCOND*/0)

# define QLIST_INSERT_HEAD (head, elm, field) do {\

If (elm)-> field.le_next = (head)-> lh_first)! = NULL)\

(head)-> lh_first- > field.le_prev = & (elm)-> field.le_next;\

(head)-> lh_first = (elm);\

(elm)-> field.le_prev = & (head)-> lh_first;\

} while (/ * CONSTCOND*/0)

Node- > next points to the next node

Node- > prev is the entry that points to the previous node, so * (node- > prev) is the address of the Nextfield of the previous node.

That is to say (* node- > prev)-> next = = node

After reading the above, do you have any further understanding of how qemu queues are implemented? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report