diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/Windows/Thread.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,38 @@
     1.4 +// Windows/Thread.h
     1.5 +
     1.6 +#ifndef __WINDOWS_THREAD_H
     1.7 +#define __WINDOWS_THREAD_H
     1.8 +
     1.9 +#include "Defs.h"
    1.10 +
    1.11 +extern "C"
    1.12 +{
    1.13 +#include "../../C/Threads.h"
    1.14 +}
    1.15 +
    1.16 +namespace NWindows {
    1.17 +
    1.18 +class CThread
    1.19 +{
    1.20 +  ::CThread thread;
    1.21 +public:
    1.22 +  CThread() { Thread_Construct(&thread); }
    1.23 +  ~CThread() { Close(); }
    1.24 +  bool IsCreated() { return Thread_WasCreated(&thread) != 0; }
    1.25 +  WRes Close()  { return Thread_Close(&thread); }
    1.26 +  WRes Create(THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter)
    1.27 +    { return Thread_Create(&thread, startAddress, parameter); }
    1.28 +  WRes Wait() { return Thread_Wait(&thread); }
    1.29 +  
    1.30 +  #ifdef _WIN32
    1.31 +  DWORD Resume() { return ::ResumeThread(thread.handle); }
    1.32 +  DWORD Suspend() { return ::SuspendThread(thread.handle); }
    1.33 +  bool Terminate(DWORD exitCode) { return BOOLToBool(::TerminateThread(thread.handle, exitCode)); }
    1.34 +  int GetPriority() { return ::GetThreadPriority(thread.handle); }
    1.35 +  bool SetPriority(int priority) { return BOOLToBool(::SetThreadPriority(thread.handle, priority)); }
    1.36 +  #endif
    1.37 +};
    1.38 +
    1.39 +}
    1.40 +
    1.41 +#endif