Zebra/quagga Threading Analysis

Source: Internet
Author: User

/ * 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.