• <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
            国产精品美女久久久久av爽| 久久久久亚洲av毛片大| 亚洲综合伊人久久综合| 久久高潮一级毛片免费| 久久婷婷综合中文字幕| 亚洲人成精品久久久久| 久久99国产精品成人欧美| 少妇久久久久久被弄到高潮| 日韩精品久久无码中文字幕| 国产精品无码久久综合网| 久久午夜福利无码1000合集| 99久久免费国产特黄| 国产69精品久久久久9999APGF | 人妻精品久久无码专区精东影业 | 亚洲精品成人网久久久久久| 国产精品久久久久久久久免费| 久久av高潮av无码av喷吹| 精品久久久久中文字幕日本| 久久婷婷人人澡人人爽人人爱| 精品久久久久久无码免费| 亚洲精品白浆高清久久久久久| 久久国产综合精品五月天| 99精品伊人久久久大香线蕉| 久久精品国产亚洲AV无码偷窥| 久久精品国产男包| 久久香综合精品久久伊人| 久久青青国产| 久久精品国产99久久久香蕉| 欧美久久精品一级c片片| 大伊人青草狠狠久久| 97精品久久天干天天天按摩| 久久久无码精品亚洲日韩京东传媒| 午夜精品久久影院蜜桃| 国产精品久久久久蜜芽| 久久有码中文字幕| 精品久久久久久无码中文字幕 | 亚洲精品蜜桃久久久久久| 久久精品国产99国产精品| 久久精品无码一区二区三区免费| 国产精品美女久久久免费| 国产成人久久精品麻豆一区|