|
#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
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.