rlm@1: // Windows/Thread.h rlm@1: rlm@1: #ifndef __WINDOWS_THREAD_H rlm@1: #define __WINDOWS_THREAD_H rlm@1: rlm@1: #include "Defs.h" rlm@1: rlm@1: extern "C" rlm@1: { rlm@1: #include "../../C/Threads.h" rlm@1: } rlm@1: rlm@1: namespace NWindows { rlm@1: rlm@1: class CThread rlm@1: { rlm@1: ::CThread thread; rlm@1: public: rlm@1: CThread() { Thread_Construct(&thread); } rlm@1: ~CThread() { Close(); } rlm@1: bool IsCreated() { return Thread_WasCreated(&thread) != 0; } rlm@1: WRes Close() { return Thread_Close(&thread); } rlm@1: WRes Create(THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter) rlm@1: { return Thread_Create(&thread, startAddress, parameter); } rlm@1: WRes Wait() { return Thread_Wait(&thread); } rlm@1: rlm@1: #ifdef _WIN32 rlm@1: DWORD Resume() { return ::ResumeThread(thread.handle); } rlm@1: DWORD Suspend() { return ::SuspendThread(thread.handle); } rlm@1: bool Terminate(DWORD exitCode) { return BOOLToBool(::TerminateThread(thread.handle, exitCode)); } rlm@1: int GetPriority() { return ::GetThreadPriority(thread.handle); } rlm@1: bool SetPriority(int priority) { return BOOLToBool(::SetThreadPriority(thread.handle, priority)); } rlm@1: #endif rlm@1: }; rlm@1: rlm@1: } rlm@1: rlm@1: #endif