libevent源碼分析1 ----evnet相關結構體分析

來源:互聯網
上載者:User

標籤:小頂堆   dia   struct   ota   oid   cache   ase   nal   const   

位於代碼event-internal.h中。

 

event_base類似事件的集合,你建立一個事件,必須將該事件指定一個集合。

struct event_base {
 50     const struct eventop *evsel; /*evsel和evbase就類比與類和對象之間的關係,evbase是evsel的
 51     一個具體實現,指在這裡使用的複用模型*/
 52     void *evbase;
 53     /*這個event_base所關注的事件數目*/
 54     int event_count;        /* counts number of total events */
 55     /*這個event_base中啟用事件的數目*/
 56     int event_count_active; /* counts number of active events */
 57     /*判斷迴圈退出的條件*/
 58     int event_gotterm;      /* Set to terminate loop */
 59     int event_break;        /* Set to terminate loop immediately */
 60
 61     /* active event management */
 62     /*只存事件鏈表,執行存放不同優先順序事件的鏈,所以使用二級指標,啟用事件的鏈表*/
 63     struct event_list **activequeues;
 64     /*事件鏈表的數目,資料是根據優先順序來決定的*/
 65     int nactivequeues;
 66
 67     /* signal handling info */
 68     /*處理訊號事件的單獨結構體*/
 69     struct evsignal_info sig;
 70     /*存放所有事件的鏈表*/
 71     struct event_list eventqueue;
 72     struct timeval event_tv;
 73     /*管理和逾時事件相關的時間小頂堆*/
 74     struct min_heap timeheap;
 75     /*存放時間的時間緩衝*/
 76     struct timeval tv_cache;
 77 };

libevent源碼分析1 ----evnet相關結構體分析

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.