亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ccocontext.cpp

?? 研讀AxCrypt對加解密的處理方法
?? CPP
字號:
/*! \file
    \brief Implementation of AxPipe::CCoContext, co-routine context holder object for Win32

    @(#) $Id: CCoContext.cpp,v 1.3 2004/02/02 12:10:47 svante Exp $

    AxPipe - Binary Stream Framework

    Copyright (C) 2003 Svante Seleborg/Axon Data, All rights reserved.

    This program is free software; you can redistribute it and/or modify it under the terms
    of the GNU General Public License as published by the Free Software Foundation;
    either version 2 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with this program;
    if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    Boston, MA 02111-1307 USA

    The author may be reached at mailto:axpipe@axondata.se and http://axpipe.sourceforge.net

    Why is this framework released as GPL and not LGPL? See http://www.gnu.org/philosophy/why-not-lgpl.html

----
\verbatim
    CCoContext.cpp                  Implementation of CCoContext, co-routine context holder object for Win32

    E-mail                          YYYY-MM-DD              Reason
    axpipe@axondata.se              2003-12-01              Initial
\endverbatim
*/
#include "stdafx.h"

#include "AxAssert.h"
#define AXLIB_ASSERT_FILE "CCoContext.cpp"

namespace AxPipe {
    /// \brief Create a new co-routine context.
    ///
    /// Construct a new context or, with a StartProc and a parameter to send it,
    /// or if no pfStart is provided, the currently executing context will be initalized
    /// to be the co-routine context.
    /// In either case it won't actually start at StartProc until Go() is called.
    /// \param pErr Pointer to an CError derived object where we can send errors.
    /// \param pfStart Pointer to a StartProc routine.
    /// \param pvParam An opaque argument to StartProc, probably a 'this' pointer.
    CCoContext::CCoContext(CError *pErr, void (*pfStart)(void *), void *pvParam) {
        m_pFiber = NULL;
        Init(pErr, pfStart, pvParam);
    }

    /// \brief Initalize the error object pointer, the StartProc and the param
    /// \param pErr Pointer to an CError derived object where we can send errors.
    /// \param pfStart Pointer to a StartProc routine.
    /// \param pvParam An opaque argument to StartProc, probably a 'this' pointer.
    void
    CCoContext::Init(CError *pErr, void (*pfStart)(void *), void *pvParam) {
        m_pErr = pErr;
        m_pfStart = pfStart;
        m_pvParam = pvParam;
    }
    
    /// \brief Stop this context.
    ///
    /// Don't destruct this object from it's own context. If you do, and it's not the
    /// original context, it's an error. If it is the original context, nothing happens
    /// and the original thread must exit and clean up all by itself.
    CCoContext::~CCoContext() {
        Stop();
    }

    /// \brief Helper for the CreateFiber call, needs a static callback, this is it.
    VOID CALLBACK
    CCoContext::Start(PVOID lpParam) {
        ((CCoContext *)lpParam)->m_pfStart(((CCoContext *)lpParam)->m_pvParam);
        // Should never get here.
    }
    
    /// \brief Switch to this objects coroutine context.
    /// If it's the first call to an instance of the current context, then
    /// initialize the object to the current context instead. If it has a StartProc
    /// and it's the first call, then we start that, otherwise we just switch back
    /// to that co-routines context.
    ///
    /// From the point of view of the caller of Go(), it'll look like any procedure call,
    /// Go() will execute and then return to the caller, but not when it executes 'return',
    /// but when that code executes a Go() to the co-routine context of the caller.
    /// \return true if we successfully switched and got back.
    bool
    CCoContext::Go() {
        // First assure we really do have a TLS index. If we don't - this is
        // an error condition.
        if (dwTlsIndex == TLS_OUT_OF_INDEXES) {
            m_pErr->SetError(ERROR_CODE_INTERNAL, ERROR_MSG_INTERNAL, _T("CoContext::Go() [No TLS available]"));
            return false;
        }
        // If this is the first call to Go() - i.e. initialize
        if (!m_pFiber) {
            m_dwThreadId = GetCurrentThreadId();
            // If we're to initialize in the current context
            if (!m_pfStart) {
                //OutputDebugString(_T("CCoContext::Go() !m_pfStart Init in current context\n"));
                // If we're not a fiber, we need to convert to one.
                if (TlsGetValue(dwTlsIndex) == NULL) {
                    //OutputDebugString(_T("CCoContext::Go() ConvertThreadToFiber(0)\n"));
                    m_pFiber = ConvertThreadToFiber(0);
                    // And now we've converted to one, we need to remember that this thread
                    // is now a fiber. If we have TLS, we set the value to true to inidcate this.
                    TlsSetValue(dwTlsIndex, (LPVOID)true);
                } else {
                    //OutputDebugString(_T("CCoContext::Go() GetCurrentFiber()\n"));
                    m_pFiber = GetCurrentFiber();
                }
                // Now m_pFiber is the current fiber.

                // We must guard against effectively doing SwitchToFiber(GetCurrentFiber())
                // Since we're just initializing this context, and want to remain here,
                // we just do a return.
                return true;
            }
            // We're to create a new fiber with a specific starting point, so
            // let's do that.
            //OutputDebugString(_T("CCoContext::Go() CreateFiber(0, Start, this)\n"));
            m_pFiber = CreateFiber(0, Start, this);
            // ...we fall through below to actually start the fiber too.
        }
        // Here the thread must have been converted to a fiber, to allow the switch.
        ASSCHK(TlsGetValue(dwTlsIndex) != NULL, _T("CoContext::Go() [Attempt to switch to fiber from non-fiber]"));
//        ASSCHK(m_dwThreadId == GetCurrentThreadId(), _T("CoContext::Go() [Attempt to schedule fiber in different thread]"));
        //OutputDebugString(_T("CCoContext::Go() SwitchToFiber()\n"));
        SwitchToFiber(m_pFiber);
        // Now we're back, because someone switched to us
        return true;
    }

    /// \brief Stop and delete a co-routine context state.
    ///
    /// If we have a fiber context, and it was not made from the then current context,
    /// and it's not ourselves that are running, we delete the fiber.
    ///
    /// (Otherwise, it must be the thread's responsibility to clean up and delete
    ///  the initial fiber of a thread. This will happen automatically when the
    ///  thread exits.)
    void
    CCoContext::Stop() {
        // If we have a StartProc and we have a fiber...
        if (m_pFiber && m_pfStart) {
            // ...and this fiber is not the current fiber...
            if (m_pFiber != GetCurrentFiber()) {
                // ... then we delete it, and forget it.
                DeleteFiber(m_pFiber);
                m_pFiber = NULL;
            } else {
                // ... otherwise we're trying to stop ourselves, which we can't do.
                ASSCHK(false, _T("Attempting to stop self"));
            }
        }
    }
};

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清一区二区三区| 在线亚洲+欧美+日本专区| 不卡影院免费观看| 91精品在线观看入口| 中文欧美字幕免费| 久久国内精品视频| 欧美日韩精品欧美日韩精品一 | 91精品国产高清一区二区三区| 国产日韩精品一区二区浪潮av| 亚洲高清不卡在线| 91美女在线观看| 欧美高清一级片在线观看| 久久精品国产久精国产| 欧美区视频在线观看| 亚洲国产视频a| 色av综合在线| 亚洲欧洲av在线| 成人午夜大片免费观看| 久久免费视频色| 国内精品伊人久久久久影院对白| 欧美一区二区日韩一区二区| 亚洲午夜羞羞片| 欧美色图第一页| 亚洲综合偷拍欧美一区色| 欧美久久久一区| 亚洲日本丝袜连裤袜办公室| 国产福利91精品一区| 精品处破学生在线二十三| 五月婷婷激情综合网| 欧美日韩美少妇| 香蕉乱码成人久久天堂爱免费| 一本色道久久综合亚洲91| 亚洲人被黑人高潮完整版| 99国产精品久久| 一区二区三区在线影院| 91成人国产精品| 午夜精品国产更新| 欧美一级高清片在线观看| 久久不见久久见中文字幕免费| 日韩免费观看高清完整版在线观看 | 亚洲一区二区三区视频在线| 日本丰满少妇一区二区三区| 亚洲成人在线网站| 本田岬高潮一区二区三区| 亚洲欧美电影院| gogogo免费视频观看亚洲一| 欧美激情一区二区三区| 成人免费视频app| 亚洲六月丁香色婷婷综合久久| 一本色道久久综合亚洲91| 亚洲午夜激情av| 精品国产伦一区二区三区观看方式 | 欧美日韩国产小视频| 日本视频一区二区三区| 国产亚洲成aⅴ人片在线观看 | 国内精品久久久久影院薰衣草| 91麻豆国产在线观看| 亚洲国产毛片aaaaa无费看| 91精品午夜视频| 国产一区二区在线看| 国产精品全国免费观看高清| 色综合久久天天| 麻豆精品一区二区av白丝在线 | 欧美在线三级电影| 蜜桃一区二区三区在线观看| 国产精品区一区二区三区| 欧美日韩国产大片| 国产精品香蕉一区二区三区| 亚洲另类春色国产| 26uuu色噜噜精品一区二区| 91欧美激情一区二区三区成人| 日韩黄色免费电影| 中文字幕在线观看不卡| 欧美日韩免费视频| 大胆亚洲人体视频| 日韩av中文字幕一区二区| 国产精品网友自拍| 欧美一二三区在线观看| 91麻豆6部合集magnet| 国产在线精品不卡| 五月综合激情日本mⅴ| 国产精品系列在线| 久久一区二区三区国产精品| 欧美日韩精品是欧美日韩精品| 国产宾馆实践打屁股91| 日本不卡在线视频| 樱花影视一区二区| 国产精品欧美综合在线| 91精品久久久久久久91蜜桃 | 午夜精品爽啪视频| 亚洲色图清纯唯美| 国产精品麻豆久久久| 久久综合色婷婷| 欧美一区二区三区视频免费| 91久久线看在观草草青青| 成人午夜电影网站| 国产精品99久久久久久久vr | 色悠悠亚洲一区二区| 国产在线不卡一区| 美女网站在线免费欧美精品| 丝袜美腿亚洲色图| 亚洲国产精品久久一线不卡| 亚洲精品视频免费看| 国产精品久久久久四虎| 国产欧美日韩另类一区| 久久免费午夜影院| 国产亚洲va综合人人澡精品| 久久午夜羞羞影院免费观看| 精品国产露脸精彩对白| 精品国产亚洲在线| 久久先锋资源网| 中文成人综合网| 中文字幕一区二区三区不卡| 国产精品视频在线看| 国产农村妇女毛片精品久久麻豆| 国产日韩欧美综合在线| 国产色婷婷亚洲99精品小说| 欧美激情在线看| 国产精品国产自产拍高清av| 自拍偷拍亚洲欧美日韩| 亚洲欧美日韩国产综合| 一区二区三区免费网站| 亚洲国产综合91精品麻豆| 视频一区二区三区中文字幕| 青草av.久久免费一区| 精品制服美女丁香| 成人av资源站| 欧美在线观看视频一区二区 | 极品瑜伽女神91| 国产高清久久久久| 99久久久国产精品| 欧美在线一二三| 欧美mv和日韩mv国产网站| 久久精品一区二区三区不卡| 国产精品国产三级国产a| 一区二区三区中文在线观看| 日本午夜一区二区| 成人精品鲁一区一区二区| 91视频一区二区| 欧美一区二区三区成人| 国产欧美日韩另类一区| 亚洲综合免费观看高清在线观看| 偷窥国产亚洲免费视频| 国产精品一区在线| 色噜噜狠狠色综合中国| 日韩欧美国产一区二区三区| 国产精品伦一区二区三级视频| 亚洲成a人在线观看| 国模套图日韩精品一区二区| 91麻豆.com| 久久欧美一区二区| 亚洲电影你懂得| 国产mv日韩mv欧美| 欧美久久久久久蜜桃| 日本一区二区成人在线| 日精品一区二区| 成人高清免费观看| 这里是久久伊人| 亚洲男人的天堂av| 精品亚洲成a人| 欧美亚一区二区| 中文字幕乱码亚洲精品一区| 日本亚洲最大的色成网站www| 91在线看国产| 久久久不卡网国产精品二区| 午夜精品影院在线观看| 99精品国产91久久久久久| 欧美v日韩v国产v| 亚洲成a天堂v人片| 91麻豆国产香蕉久久精品| 国产婷婷色一区二区三区| 蜜桃久久久久久久| 欧美伊人久久大香线蕉综合69| 欧美激情一二三区| 国产精品自产自拍| 日韩一级片网站| 日韩精品久久久久久| 欧美在线短视频| 亚洲精品欧美综合四区| 99久久国产免费看| 日本一区二区免费在线观看视频| 麻豆极品一区二区三区| 在线播放中文字幕一区| 一区二区三区在线视频免费| 99精品欧美一区二区蜜桃免费| 国产午夜久久久久| 国产综合久久久久久久久久久久| 欧美另类一区二区三区| 亚洲一区二区三区四区的| 日本韩国一区二区| 亚洲精品欧美专区| 在线免费亚洲电影| 一区二区三区 在线观看视频| 99国产欧美另类久久久精品| 亚洲欧美自拍偷拍| 91欧美一区二区| 亚洲综合自拍偷拍| 欧美女孩性生活视频| 午夜精品福利视频网站| 91精品国产综合久久久久久漫画|