• <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
            狠狠综合久久综合88亚洲| 亚洲精品第一综合99久久| 国产色综合久久无码有码| 久久影视国产亚洲| 综合久久一区二区三区| 久久精品成人欧美大片| 亚洲欧美伊人久久综合一区二区| 少妇人妻88久久中文字幕| 国产精品久久久天天影视| 久久久91精品国产一区二区三区 | 久久成人国产精品| 青青草国产精品久久| 久久黄视频| 无码AV中文字幕久久专区| 大蕉久久伊人中文字幕| 久久久久精品国产亚洲AV无码| 国产精品久久久亚洲| 久久综合成人网| 久久国产成人精品麻豆| 久久精品中文字幕大胸| 亚洲国产精品无码久久98| 狠狠色丁香久久综合婷婷| 要久久爱在线免费观看| 蜜桃麻豆www久久| 精品久久久久久国产| 国内精品久久久久国产盗摄| 久久综合狠狠综合久久综合88| 久久久久无码国产精品不卡| 国产精品美女久久久久| 国产成人精品久久| 午夜福利91久久福利| 亚洲成人精品久久| 久久国产精品77777| 久久频这里精品99香蕉久| 亚洲国产精品人久久| 国产精品久久久久久久 | 亚洲一区中文字幕久久| 日本免费一区二区久久人人澡| 久久99精品国产99久久| 久久这里只有精品久久| 久久免费观看视频|