aboutsummaryrefslogtreecommitdiff
path: root/operating-system-experiment/Thread.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-10 11:35:29 +0800
committercrupest <crupest@outlook.com>2021-06-10 11:35:29 +0800
commitdf97d69a45ba4e50114458e2b5c4185460f2d9f3 (patch)
tree6eeaab0f3877dd92af2d39812c63c7bb9e5bebd9 /operating-system-experiment/Thread.cpp
parent3128281e50d30d12a053bc06018df4efcc8e988e (diff)
downloadlife-df97d69a45ba4e50114458e2b5c4185460f2d9f3.tar.gz
life-df97d69a45ba4e50114458e2b5c4185460f2d9f3.tar.bz2
life-df97d69a45ba4e50114458e2b5c4185460f2d9f3.zip
...
Diffstat (limited to 'operating-system-experiment/Thread.cpp')
-rw-r--r--operating-system-experiment/Thread.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/operating-system-experiment/Thread.cpp b/operating-system-experiment/Thread.cpp
index 7e3c784..a5f526d 100644
--- a/operating-system-experiment/Thread.cpp
+++ b/operating-system-experiment/Thread.cpp
@@ -112,7 +112,10 @@ void Thread::Destroy() noexcept {
joined_ = false;
#ifdef CRU_WINDOWS
thread_id_ = 0;
- thread_handle_ = nullptr;
+ if (thread_handle_ != nullptr) {
+ CloseHandle(thread_handle_);
+ thread_handle_ = nullptr;
+ }
#else
thread_ = nullptr;
#endif