Mercurial > vba-clojure
view src/win32/7zip/7z/CPP/Windows/Thread.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line source
1 // Windows/Thread.h3 #ifndef __WINDOWS_THREAD_H4 #define __WINDOWS_THREAD_H6 #include "Defs.h"8 extern "C"9 {10 #include "../../C/Threads.h"11 }13 namespace NWindows {15 class CThread16 {17 ::CThread thread;18 public:19 CThread() { Thread_Construct(&thread); }20 ~CThread() { Close(); }21 bool IsCreated() { return Thread_WasCreated(&thread) != 0; }22 WRes Close() { return Thread_Close(&thread); }23 WRes Create(THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter)24 { return Thread_Create(&thread, startAddress, parameter); }25 WRes Wait() { return Thread_Wait(&thread); }27 #ifdef _WIN3228 DWORD Resume() { return ::ResumeThread(thread.handle); }29 DWORD Suspend() { return ::SuspendThread(thread.handle); }30 bool Terminate(DWORD exitCode) { return BOOLToBool(::TerminateThread(thread.handle, exitCode)); }31 int GetPriority() { return ::GetThreadPriority(thread.handle); }32 bool SetPriority(int priority) { return BOOLToBool(::SetThreadPriority(thread.handle, priority)); }33 #endif34 };36 }38 #endif