diff options
author | Jeff Cohen <jeffc@jolt-lang.org> | 2007-03-05 05:22:08 +0000 |
---|---|---|
committer | Jeff Cohen <jeffc@jolt-lang.org> | 2007-03-05 05:22:08 +0000 |
commit | 0a1826724821945653477c867c77ea6f245bab02 (patch) | |
tree | 98962e3543ed39750b94f5f2bcaa33ce825ec599 /lib/System/Win32/Win32.h | |
parent | f15bd1b9c66ca11776060ae0db2024d741d9de2d (diff) | |
download | external_llvm-0a1826724821945653477c867c77ea6f245bab02.zip external_llvm-0a1826724821945653477c867c77ea6f245bab02.tar.gz external_llvm-0a1826724821945653477c867c77ea6f245bab02.tar.bz2 |
Implement memoryLimit on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Win32/Win32.h')
-rw-r--r-- | lib/System/Win32/Win32.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/System/Win32/Win32.h b/lib/System/Win32/Win32.h index 74406ae..71f0be5 100644 --- a/lib/System/Win32/Win32.h +++ b/lib/System/Win32/Win32.h @@ -34,3 +34,24 @@ inline bool MakeErrMsg(std::string* ErrMsg, const std::string& prefix) { LocalFree(buffer); return true; } + +class AutoHandle { + HANDLE handle; + +public: + AutoHandle(HANDLE h) : handle(h) {} + + ~AutoHandle() { + if (handle) + CloseHandle(handle); + } + + operator HANDLE() { + return handle; + } + + AutoHandle &operator=(HANDLE h) { + handle = h; + return *this; + } +}; |