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

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

?? csync.h

?? 研讀AxCrypt對加解密的處理方法
?? H
字號:
#pragma once
#ifndef AXPIPE_CSYNC_H
#define AXPIPE_CSYNC_H
/*! \file CSync.h
    \brief Thread synchronization class AxPipe::CSync

    @(#) $Id: CSync.h,v 1.2 2004/01/01 20:05:54 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
    CSync.h                         Thread synchronization class

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

#include "AxAssert.h"
#define AXLIB_ASSERT_FILE "CSync.h"

namespace AxPipe {
/// \brief Provide single-process mutual exclusion synchronization
///
/// This is typically used as an additional base class for objects that need
/// assured mutually exclusive access. Specifically CSignal objects derive from this.
class CCriticalSection {
private:
    int m_iLockCount;
    CRITICAL_SECTION cs;

public:
    CCriticalSection() {
        InitializeCriticalSection(&cs);
        m_iLockCount = 0;
    }

public:
    ~CCriticalSection() {
        DeleteCriticalSection(&cs);
    }

public:
    /// \brief Get lock, or wait until we do get it. It's ok to call multiple times.
    void GetLock() {
        EnterCriticalSection(&cs);
        m_iLockCount++;
    }

public:
    /// \brief Release lock. We must have it. Must release the same number as we get locks.
    void ReleaseLock() {
        m_iLockCount--;
        LeaveCriticalSection(&cs);
    }

public:
    /// \brief Create an instance of this class in a block that needs exclusive access. 
    template<class T> class Lock {
        T *m_pcs;
    
    public:
        Lock(T *pcs) {
            ASSPTR(pcs);
            if ((m_pcs = pcs) != NULL) {
                pcs->GetLock();
            }
        }
    
    public:
        void ReleaseLock() {
            if (m_pcs != NULL) {
                m_pcs->ReleaseLock();
                m_pcs = NULL;
            }
        }
    
    public:
        ~Lock() {
            if (m_pcs != NULL) {
                m_pcs->ReleaseLock();
            }
        }
    };
};
/// \brief Thread synchronization.
///
/// Event-based thread synchronization.
class CSync {
private:
    HANDLE m_hEvent;                        ///< The event object to synchronize with.
public:
    CSync();                                ///< Create the event.
    ~CSync();                               ///< Close the event.
    bool Wait(int iMs = -1);                ///< Wait for someone to call Signal() for iMs milliseconds.
    bool Signal();                          ///< Send a signal to someone who's waiting with Wait().
};
/// \brief A small collection of objects and methods for thread sync
///
/// Threads often need synchronized access to shared data, and control
/// the the passing of the data. This class implements methods for this
/// under a 'work' paradigm. Thread A wants to pass off a piece of work
/// in some form of shared medium, i.e. shared memory for example, to
/// thread B. The sequence is then:
///     A                                   B
///                                         ...
///                                         WorkWait()
///     ...
///     WorkStart()
///     WorkSignal()
///                                         ...
///                                         WorkEnd()
///
/// The methods ensure that when WorkStart() returns, no other thread is between
/// WorkStart() and WorkEnd(). It's also guaranteed that when WorkSignal()
/// returns, thread B has received the signal via WorkWait(). Owneship of the
/// shared resource passes from A to B upon return from WorkSignal() and WorkWait()
/// respectively. Thread B relinquishes it's hold, upon call to WorkEnd(), and as
/// previously noted Thread A get's ownership upon return of WorkStart().
class CThreadSync {
    HANDLE m_hSemaphore;                    ///< Enable serialization of requests for processing, can't use a Mutex, as it's sometimes the same thread we need to control
    CSync m_Work,                           ///< Signal when worker has work to do.
          m_Accepted;                       ///< Signal when worker has accepted signal.
public:
    CThreadSync();                          ///< Initialize sync objects
    ~CThreadSync();                         ///< Clean up
    void WorkStart();                       ///< Initiate one Work() cycle
    void WorkSignal();                      ///< Signal that we've prepared for more Work()
    void WorkWait();                        ///< Wait for more to be ready for Work()
    void WorkEnd();                         /// End one Work() cycle
};

/// \brief a Template class that will create a thread for a method virtual int Main()
template <class T> class CThreadMain : public T {
    DWORD m_dwThreadId;                     ///< The ThreadId of the started thread.
    HANDLE m_hThread;                       ///< Handle to the worker thread.
private:
    /// \brief static helper to get back into the class after starting the thread
    /// Calls the virtual Main(), returns the result of that as the thread exit code.
    /// \param lpParam the 'this' pointer of the class containing the worker thread.
    static DWORD WINAPI Main(LPVOID lpParam) {
        return ((CThreadMain<T> *)lpParam)->Main();
    }

    /// \brief The main() of the thread, derived classes must override
    ///
    /// A separate thread will be started, calling this function and
    /// returning it's return value as the thread exit code.
    ///
    /// \return The thread exit code
    virtual int Main() {
        ASSCHK(false, _T("Override of 'virtual int Main()' missing"));
        return 0;
    }
public:
    /// \brief Create thread and set priority.
    ///
    /// The thread will not start, it is created initially suspended. Use
    /// CThreadMain::Run() to start it.
    CThreadMain() {
        // As we can't set a proper process prio below 2k version, we manually inherit current
        // thread priority.
        int iCurPrio = GetThreadPriority(GetCurrentThread());
        ASSAPI((m_hThread = CreateThread(NULL, 0, Main, this, CREATE_SUSPENDED, &m_dwThreadId))!= NULL);
        SetThreadPriority(m_hThread, iCurPrio);
    }

    /// \brief Wait for the worker thread to terminate, then close handles etc.
    virtual ~CThreadMain() {
        ASSAPI(WaitForSingleObject(m_hThread, INFINITE) == WAIT_OBJECT_0);
        ASSAPI(CloseHandle(m_hThread));
    }

    /// \brief Start the thread running
    void Run() {
        ResumeThread(m_hThread);
    }

    /// \brief Wait for the worker thread to end - called from outside worker thread, Obviously.
    void Wait() {
        WaitForSingleObject(m_hThread, INFINITE);
    }
};
}; // namespace AxPipe
#endif AXPIPE_CSYNC_H

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲日本一区| 中文字幕不卡三区| 日本一道高清亚洲日美韩| 欧美日韩电影一区| 美日韩一区二区三区| 日韩欧美123| 国产精品99久久久久久久vr| 国产日韩欧美不卡在线| 成人国产电影网| 一区二区三区欧美久久| 欧美绝品在线观看成人午夜影视| 蜜桃视频第一区免费观看| 欧美精品一区二区久久久| 国产专区欧美精品| 亚洲欧洲99久久| 欧美日本一道本在线视频| 精品在线一区二区三区| 欧美国产激情一区二区三区蜜月| 91在线观看免费视频| 偷窥国产亚洲免费视频| 久久在线免费观看| 在线中文字幕不卡| 捆绑紧缚一区二区三区视频| 亚洲国产激情av| 欧美日韩三级一区二区| 欧美中文字幕一二三区视频| 欧美a级一区二区| 中文乱码免费一区二区| 欧美系列在线观看| 国产成人在线电影| 亚洲成人一二三| 久久九九全国免费| 欧美日韩免费视频| 丁香婷婷深情五月亚洲| 天天综合网 天天综合色| 国产精品每日更新| 日韩视频在线永久播放| 99久久综合色| 狠狠色综合色综合网络| 亚洲高清免费一级二级三级| 久久久久高清精品| 欧美一区二区免费观在线| caoporn国产精品| 激情国产一区二区| 日韩有码一区二区三区| 中文字幕亚洲一区二区av在线| 欧美一区二区三区在线电影| 99re在线视频这里只有精品| 精品制服美女丁香| 日本美女一区二区三区视频| 亚洲欧美一区二区三区国产精品 | 精品日韩一区二区三区| 欧美图片一区二区三区| av不卡在线观看| 国产揄拍国内精品对白| 日韩国产精品久久| 洋洋av久久久久久久一区| 中文字幕 久热精品 视频在线| 日韩一区二区三区电影在线观看| 91国偷自产一区二区三区观看| 国产二区国产一区在线观看| 美女被吸乳得到大胸91| 亚州成人在线电影| 一区二区高清免费观看影视大全| 国产精品免费aⅴ片在线观看| 精品少妇一区二区三区在线播放 | 欧美一区二区三区视频免费播放| 一本久久a久久精品亚洲| 懂色中文一区二区在线播放| 国内成人精品2018免费看| 久久精品国产精品青草| 日韩电影在线免费观看| 亚洲18色成人| 午夜精品福利视频网站| 亚洲女同ⅹxx女同tv| 久久激五月天综合精品| eeuss鲁一区二区三区| 精品亚洲porn| 国产一区三区三区| 国产精品亚洲成人| 国产一区二区三区免费在线观看| 免费在线观看一区二区三区| 毛片不卡一区二区| 韩日精品视频一区| 国产精品2024| 不卡视频在线观看| 日本国产一区二区| 欧美三级欧美一级| 欧美一区二区久久久| 日韩三级伦理片妻子的秘密按摩| 日韩精品一区二| 精品av久久707| 欧美高清在线一区| 亚洲一区在线观看免费| 日韩激情视频在线观看| 精品一二线国产| 成人一区二区三区视频在线观看| 97精品国产97久久久久久久久久久久 | 日本一区二区免费在线观看视频 | 亚洲精品一区在线观看| 国产婷婷色一区二区三区在线| 国产精品网站导航| 一区二区视频免费在线观看| 日韩激情一二三区| 粉嫩av一区二区三区在线播放| 91社区在线播放| 91麻豆精品国产91久久久使用方法| 精品国免费一区二区三区| 国产精品无人区| 午夜久久电影网| 国产福利一区二区三区视频| 91香蕉视频污在线| 玉足女爽爽91| 久久精工是国产品牌吗| va亚洲va日韩不卡在线观看| 欧美亚洲动漫精品| 欧美va天堂va视频va在线| 国产精品乱码一区二三区小蝌蚪| 亚洲一区二区三区国产| 国产精品综合av一区二区国产馆| 99热99精品| 精品999在线播放| 夜夜嗨av一区二区三区网页| 国内偷窥港台综合视频在线播放| 色综合久久天天| 久久综合久久99| 亚洲国产日韩综合久久精品| 国内成人免费视频| 欧美日韩aaaaa| 国产精品日韩成人| 蜜桃久久av一区| 91成人免费在线视频| 久久久五月婷婷| 三级久久三级久久久| 白白色 亚洲乱淫| 精品久久久久香蕉网| 亚洲国产wwwccc36天堂| 成人国产免费视频| 2021久久国产精品不只是精品| 亚洲国产精品影院| 99久久久久久| 国产人成亚洲第一网站在线播放 | 国内精品伊人久久久久av一坑 | 欧美一区二区精美| 一区二区三区**美女毛片| 成人永久免费视频| 久久精品亚洲乱码伦伦中文| 男男gaygay亚洲| 欧美性生活大片视频| 亚洲色图在线播放| 国产91精品一区二区麻豆网站| 日韩女优av电影| 免费在线一区观看| 欧美一区二区三区四区在线观看| 亚洲另类中文字| 99在线精品观看| 国产精品九色蝌蚪自拍| 国产精品一级黄| 日本一区二区在线不卡| 欧美一二三四区在线| 亚洲成人一区在线| 欧美精品粉嫩高潮一区二区| 亚洲国产人成综合网站| 一本色道久久综合狠狠躁的推荐| 中文字幕一区二区日韩精品绯色| 国产91在线|亚洲| 国产欧美一区二区精品仙草咪| 国产福利精品一区| 久久久国产精品麻豆| 国产一二精品视频| 国产偷v国产偷v亚洲高清| 国产精品77777| 国产精品久久久久一区二区三区| 成人高清免费在线播放| 一区免费观看视频| 色婷婷狠狠综合| 午夜伦理一区二区| 制服丝袜在线91| 韩国精品在线观看| 欧美国产精品久久| 91看片淫黄大片一级在线观看| 亚洲欧洲中文日韩久久av乱码| 欧美三级电影网| 美腿丝袜亚洲三区| 欧美极品aⅴ影院| 色综合中文字幕国产 | 偷拍一区二区三区四区| 欧美一区二区三区公司| 国产原创一区二区| 综合久久久久久| 8v天堂国产在线一区二区| 九九视频精品免费| 亚洲欧美综合网| 7777精品伊人久久久大香线蕉最新版 | 亚洲精品一卡二卡| 日韩亚洲欧美成人一区| 高清shemale亚洲人妖| 亚洲精选一二三| 日韩精品一区二区三区视频 | 国产尤物一区二区在线|