/ * Threads are categorized according to different functions. There are 6 double chains, each representing different types of threads. When it's going to run,
* is removed from a different list, added to the Ready linked list, and after the run is completed, the thread structure is emptied and placed into the
* Unuse linked list. The resources of the existing Unuse list are generally used, which are added in different linked lists according to the function.
* Only when the thread structure is used, that is, when the Ununse list is empty, re-apply for new space */structthread_master{structThread_list Read; structThread_list Write; structthread_list Timer; structThread_listEvent; structThread_list ready; structthread_list Unuse; Fd_set READFD; Fd_set WRITEFD; Fd_set exceptfd; unsignedLongalloc;};/ * The thread_list structure is used to record information for each type of linked list. Head pointing to double-stranded head, tail to double-stranded footer
* Count records the number of nodes in the current list * /structthread_list{structThread *Head; structThread *tail; intcount;};/ * Data for a single thread is included in different thread_list structures, depending on the functionality.
* After the thread call is complete, the internal information is emptied and added to the Unuse list */structthread{thread_type type; Thread_type Add_type; structThread *Next; structThread *prev; structThread_master *master; int(*func) (structThread *);/*processing functions stored in a thread*/ void*arg;/*parameters saved in the thread*/Union {intVal; intFD; structTimeval Sands; } u; rusage_t Ru; structCpu_thread_history *hist; Char*funcname;};
Zebra/quagga Threading Analysis