📄 thread.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -