This commit is contained in:
Igor Pavlov
2003-12-11 00:00:00 +00:00
committed by Kornel Lesiński
commit 8c1b5c7b7e
982 changed files with 118799 additions and 0 deletions

45
Windows/Thread.h Executable file
View File

@@ -0,0 +1,45 @@
// Windows/Thread.h
#pragma once
#ifndef __WINDOWS_THREAD_H
#define __WINDOWS_THREAD_H
#include "Handle.h"
#include "Defs.h"
namespace NWindows {
class CThread: public CHandle
{
public:
bool Create(LPSECURITY_ATTRIBUTES threadAttributes,
SIZE_T stackSize, LPTHREAD_START_ROUTINE startAddress,
LPVOID parameter, DWORD creationFlags, LPDWORD threadId)
{
_handle = ::CreateThread(threadAttributes, stackSize, startAddress,
parameter, creationFlags, threadId);
return (_handle != NULL);
}
bool Create(LPTHREAD_START_ROUTINE startAddress, LPVOID parameter)
{
DWORD threadId;
return Create(NULL, 0, startAddress, parameter, 0, &threadId);
}
DWORD Resume()
{ return ::ResumeThread(_handle); }
DWORD Suspend()
{ return ::SuspendThread(_handle); }
bool Terminate(DWORD exitCode)
{ return BOOLToBool(::TerminateThread(_handle, exitCode)); }
int GetPriority()
{ return ::GetThreadPriority(_handle); }
bool SetPriority(int priority)
{ return BOOLToBool(::SetThreadPriority(_handle, priority)); }
};
}
#endif