zebra/quagga线程分析

复制代码
/* 线程按照不同的功能进行分类。有6条双链,分别表示不同类型的线程。将要运行的时候,
* 就从不同的链表中取出,添加到ready链表中,运行完成之后,将线程结构体清空放到
* unuse链表中。一般利用现有unuse链表的资源,根据功能添加在不同的链表中。
* 只有当线程结构体都使用了,即ununse链表空的时候,才重新申请新的空间 */
struct thread_master { struct thread_list read; struct thread_list write; struct thread_list timer; struct thread_list event; struct thread_list ready; struct thread_list unuse; fd_set readfd; fd_set writefd; fd_set exceptfd; unsigned long alloc; }; /* thread_list结构体用于记录每种链表的信息。head指向双链表头,tail指向双链表尾
* count记录当前链表中有多少个节点 */
struct thread_list { struct thread *head; struct thread *tail; int count; }; /* 单个线程的数据,按照功能不同包含在不同的thread_list结构中。
* 线程调用完成之后,将内部的信息清空,添加到unuse链表中 */
struct thread { thread_type type; thread_type add_type; struct thread *next; struct thread *prev; struct thread_master *master; int (*func) (struct thread *); /* 线程中保存的处理函数 */ void *arg; /* 线程中保存的参数 */ union {   int val;   int fd;   struct timeval sands; } u; RUSAGE_T ru; struct cpu_thread_history *hist; char* funcname; };
复制代码

 

posted @   SuperTao1024  阅读(502)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· .NET Core 中如何实现缓存的预热?
· 三行代码完成国际化适配,妙~啊~
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
点击右上角即可分享
微信分享提示