zoukankan      html  css  js  c++  java
  • 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; };
  • 相关阅读:
    Java中的流
    多种日志收集工具比较
    UML类图几种关系的总结
    从数组中找出第K大的数
    数组各种排序算法和复杂度分析
    时间复杂度和空间复杂度
    Java Classloader原理分析
    WebSocket
    TCP/IP详解--TCP连接中TIME_WAIT状态过多
    TCP协议
  • 原文地址:https://www.cnblogs.com/helloworldtoyou/p/4890578.html
Copyright © 2011-2022 走看看