• <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>
            隨筆 - 298  文章 - 377  trackbacks - 0
            <2017年10月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(34)

            隨筆分類

            隨筆檔案

            文章檔案

            相冊

            收藏夾

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            1、創建IOCP

            ACE_WIN32_Proactor::ACE_WIN32_Proactor (size_t number_of_threads,

                                                    int used_with_reactor_event_loop)

             : completion_port_ (0),

                // This *MUST* be 0, *NOT* ACE_INVALID_HANDLE !!!

                number_of_threads_ (static_cast<DWORD> (number_of_threads)),

                used_with_reactor_event_loop_ (used_with_reactor_event_loop)

            {

             // Create the completion port.

             this->completion_port_ = ::CreateIoCompletionPort (INVALID_HANDLE_VALUE,

                                                                 0,

                                                                 0,

                                                                 this->number_of_threads_);

            //...

            }

            2、將一個句柄同完成端口關聯到一起

            int

            ACE_WIN32_Proactor::register_handle (ACE_HANDLE handle,

                                                 const void *completion_key)

            {

            #if defined (_MSC_VER) && (_MSC_VER < 1300)

             ULONG comp_key (reinterpret_cast<ULONG> (completion_key));

            #else

              ULONG_PTR comp_key (reinterpret_cast<ULONG_PTR> (completion_key));

            #endif

             

             // No locking is needed here as no state changes.

             ACE_HANDLE cp = ::CreateIoCompletionPort (handle,

                                                        this->completion_port_,

                                                        comp_key,

                                                        this->number_of_threads_);

            //...

            }

             

             

             

            3、投遞一個(或多個)異步操作

            4、在完成端口上等待

            int

            ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds)

            {

              ACE_OVERLAPPED *overlapped = 0;

              u_long bytes_transferred = 0;

            #if defined (_MSC_VER) && (_MSC_VER < 1300)

              ULONG completion_key = 0;

            #else

              ULONG_PTR completion_key = 0;

            #endif

             

              // Get the next asynchronous operation that completes

              BOOL result = ::GetQueuedCompletionStatus (this->completion_port_,

                                                         &bytes_transferred,

                                                         &completion_key,

                                                         &overlapped,

                                                         milli_seconds);

            //Check errors

             

            //Execute the completion handler

                this->application_specific_code (asynch_result,

                                                   static_cast<size_t> (bytes_transferred),

                                                   (void *) completion_key,

                                                   result_err);

              return 1;

            }

             

             

            posted on 2007-08-17 12:01 聶文龍 閱讀(401) 評論(0)  編輯 收藏 引用 所屬分類: net work
            久久精品成人免费网站| 久久性精品| 国产精品99久久久久久www| 久久久久亚洲精品男人的天堂| A级毛片无码久久精品免费| 东京热TOKYO综合久久精品| 伊人久久精品影院| 嫩草影院久久国产精品| 精品久久久久久国产| 国产精品免费看久久久香蕉| 久久久老熟女一区二区三区| 性做久久久久久久久| 四虎国产精品免费久久久 | 东京热TOKYO综合久久精品| 久久久久亚洲精品中文字幕| 狠狠色噜噜狠狠狠狠狠色综合久久| 精品久久久久久无码不卡| 久久国产美女免费观看精品| 成人妇女免费播放久久久| 中文精品久久久久人妻不卡| 久久亚洲国产成人影院网站 | 热re99久久6国产精品免费| 久久久久亚洲AV成人网人人软件 | 久久综合噜噜激激的五月天| 亚洲色欲久久久久综合网| 亚洲国产精品久久久久婷婷软件| 久久婷婷成人综合色综合| 久久精品国产亚洲αv忘忧草| 久久久久国产精品三级网| 久久久久18| 亚洲综合久久夜AV | 亚洲午夜无码AV毛片久久| 伊人久久亚洲综合影院| 久久久亚洲裙底偷窥综合| 国产成人精品久久| 久久综合综合久久综合| 国产精品久久久久久一区二区三区 | 久久久久亚洲精品无码蜜桃| 久久99精品久久久久久动态图 | 国产精品青草久久久久福利99| 996久久国产精品线观看|