• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 58,  comments - 75,  trackbacks - 0

            ??? 多路分配的入口函數(shù)handle_events,在框架的實現(xiàn)接口類中定義
            ??? 多路分配的主體實現(xiàn)函數(shù)event_handling,在ACE_WFMO_Reactor中定義,偽
            實現(xiàn)代碼如下
            int ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time,
            ????????????????????????????????????? int alertable)
            {
            ? int result = 0;
            ?
            ? do
            ? {
            ????? //等待在句柄集上發(fā)生的事件
            ????? //wait_for_multiple_events的具體實現(xiàn)是使用
            ????? //WaitForMultipleObjectsEx函數(shù)
            ????? DWORD wait_status = this->wait_for_multiple_events (timeout,
            ????????????????????????????????????????????????????????? alertable);
            ????? //分發(fā)事件
            ????? result = this->safe_dispatch (wait_status);
            ? }while (result == 0);

            ? return result;
            }

            ??? 分發(fā)的主體函數(shù)是dispatch_handles,在ACE_WFMO_Reactor中定義,偽實現(xiàn)
            代碼如下
            int ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status)
            {
            ? DWORD dispatch_slot = 0;

            ? //活動的句柄總數(shù)
            ? DWORD max_handlep1 = this->handler_rep_.max_handlep1 ();

            ? //查找要分發(fā)的句柄的索引
            ? for (int number_of_handlers_dispatched = 1;;++number_of_handlers_dispatched)
            ? {
            ????? //計算有事件發(fā)生,要分發(fā)的句柄索引
            ????? dispatch_slot += wait_status - WAIT_OBJECT_0;
            ????? //分發(fā)給相應(yīng)的事件處理對象
            ????? if (this->dispatch_handler (dispatch_slot, max_handlep1) == -1)
            ??????? return -1;

            ????? ++dispatch_slot;

            ????? if (dispatch_slot >= max_handlep1)
            ??????? return number_of_handlers_dispatched;//分發(fā)了幾個事件

            ????? //檢查剩下的句柄中有沒有有事件發(fā)生的
            ????? wait_status = this->poll_remaining_handles (dispatch_slot);
            ????? switch (wait_status)
            ????? {
            ??????? case WAIT_FAILED: // Failure.
            ????????? ACE_OS::set_errno_to_last_error ();
            ????????? /* FALLTHRU */
            ??????? case WAIT_TIMEOUT:
            ????????? // There are no more handles ready, we can return.
            ????????? return number_of_handlers_dispatched;//分發(fā)了幾個事件
            ????? }
            ? }
            }

            ??? 找到具體事件處理對象主體函數(shù)complex_dispatch_hander,在ACE_WFMO_Reactor
            中定義,為代碼如下
            int ACE_WFMO_Reactor::complex_dispatch_handler (DWORD slot,
            ??????????????????????????????????????????????? ACE_HANDLE event_handle)
            {
            ? //找到當(dāng)前的分發(fā)的信息
            ? ACE_WFMO_Reactor_Handler_Repository::Current_Info &current_info =
            ??? this->handler_rep_.current_info ()[slot];

            ? WSANETWORKEVENTS events;
            ? ACE_Reactor_Mask problems = ACE_Event_Handler::NULL_MASK;
            ? if (::WSAEnumNetworkEvents ((SOCKET) current_info.io_handle_,
            ????????????????????????????? event_handle,
            ????????????????????????????? &events) == SOCKET_ERROR)
            ??? problems = ACE_Event_Handler::ALL_EVENTS_MASK;
            ? else
            ? {
            ????? //發(fā)生的事件于要檢測的事件是否相同,相同就分發(fā)
            ????? events.lNetworkEvents &= current_info.network_events_;
            ????? while (events.lNetworkEvents != 0)
            ????? {
            ????????? ACE_Event_Handler *event_handler = current_info.event_handler_;

            ????????? //調(diào)用事件處理對象,進(jìn)行事件處理
            ????????? problems |= this->upcall (current_info.event_handler_,
            ??????????????????????????????????? current_info.io_handle_,
            ??????????????????????????????????? events);

            ????????? if (this->handler_rep_.scheduled_for_deletion (slot))
            ??????????? break;
            ????? }
            ? }

            ? return 0;
            }

            posted on 2007-02-22 11:46 walkspeed 閱讀(1412) 評論(0)  編輯 收藏 引用 所屬分類: ACE Farmeworks

            <2007年2月>
            28293031123
            45678910
            11121314151617
            18192021222324
            25262728123
            45678910

            常用鏈接

            留言簿(4)

            隨筆分類(64)

            隨筆檔案(58)

            文章分類(3)

            文章檔案(3)

            相冊

            收藏夾(9)

            C++零碎

            好友

            搜索

            •  

            積分與排名

            • 積分 - 161513
            • 排名 - 163

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品无码av| 久久综合精品国产二区无码| 久久久WWW成人| 伊人久久大香线蕉av不变影院| 91久久精一区二区三区大全| 精品久久久久久无码中文野结衣| 亚洲午夜久久久久妓女影院| 99热精品久久只有精品| 色偷偷久久一区二区三区| 狠狠色伊人久久精品综合网 | 日韩精品国产自在久久现线拍| 久久涩综合| 狠狠色丁香久久综合五月| 97视频久久久| 欧美与黑人午夜性猛交久久久 | 国产综合久久久久| 亚洲AV无码久久| 日产久久强奸免费的看| 国産精品久久久久久久| 91精品国产综合久久香蕉 | 国产99久久久国产精品~~牛| 久久久久人妻一区精品性色av| 人人狠狠综合88综合久久| 99久久免费国产精品| 91精品国产综合久久香蕉 | 亚洲国产精品无码久久九九| 国产精品九九久久精品女同亚洲欧美日韩综合区 | 99久久综合国产精品免费| 久久最新免费视频| 久久青青国产| 亚洲七七久久精品中文国产| 中文字幕精品久久久久人妻| 欧美精品福利视频一区二区三区久久久精品 | 久久久精品久久久久久 | 亚洲精品国产综合久久一线| 久久精品成人影院| 999久久久国产精品| 国产日韩久久免费影院| 久久性精品| 久久精品一本到99热免费| 亚洲AV日韩精品久久久久|