thread.h

来自「wince6.0平台上的任务管理器,功能类似于windows的任务管理器. 」· C头文件 代码 · 共 49 行

H
49
字号

#ifndef I_THREADS_THREAD_H
#define I_THREADS_THREAD_H

#include <Windows.h>
#include "Windows\AutoCriticalSection.h"
#include "Windows\Handle.h"

namespace Threads
{
    class Thread
    {
    public:
        Thread();
    protected:
        virtual ~Thread();
    private:
        Thread(const Thread& other); // Prevent copying
        Thread& operator = (const Thread& other);  // Prevent assigning

    public:
        bool IsStopped() const
        {
            return m_stopped;
        }
        HANDLE GetThreadHandle() const
        {
            return m_thread;
        }
        void Start(unsigned int stackSize = 0x10000);
        virtual void Stop();
        static void Sleep(unsigned int msecs);
        void SetThreadPriority(int priority);
        virtual void Run() = 0;

    private:
        static unsigned __stdcall RunEntry(void* arglist);

    private:
        volatile bool    m_stopped;
        Windows::Handle    m_thread;
        Windows::CriticalSection    m_lock;
    };

} // namespace Threads

#endif // I_THREADS_THREAD_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?