• <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
            <2013年6月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            30123456

            常用鏈接

            留言簿(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 聶文龍 閱讀(397) 評論(0)  編輯 收藏 引用 所屬分類: net work
            亚洲精品国精品久久99热一| 亚洲精品乱码久久久久久中文字幕 | 久久99国产综合精品| 国产69精品久久久久9999APGF| 99久久综合国产精品免费| 久久男人AV资源网站| 7777精品伊人久久久大香线蕉 | 精品久久久久久久中文字幕 | 久久艹国产| 亚洲狠狠婷婷综合久久蜜芽 | 久久久久波多野结衣高潮| 国产精品99精品久久免费| 久久e热在这里只有国产中文精品99 | 久久午夜电影网| 亚洲精品无码久久久久| 精品久久久久久久久久久久久久久| 国产精品乱码久久久久久软件 | 中文成人久久久久影院免费观看| 无码超乳爆乳中文字幕久久| 久久久久一级精品亚洲国产成人综合AV区| 亚洲午夜久久久久久久久电影网| 国产亚洲成人久久| 久久精品免费观看| 久久精品天天中文字幕人妻| 久久久久久久久久久精品尤物 | 九九热久久免费视频| 久久精品国产91久久麻豆自制| 久久久久久综合网天天| 一本一道久久a久久精品综合| 成人国内精品久久久久影院VR| 国产精品久久久久jk制服| 日韩精品久久久久久免费| 欧美伊人久久大香线蕉综合| 色婷婷综合久久久久中文字幕| 久久久亚洲精品蜜桃臀| 久久一区二区三区免费| 女同久久| 新狼窝色AV性久久久久久| 亚洲AV无码久久精品蜜桃| 精品无码久久久久国产动漫3d| A级毛片无码久久精品免费 |