Index: runtime/platform/thread_win.cc |
diff --git a/runtime/platform/thread_win.cc b/runtime/platform/thread_win.cc |
index 18ec6d0bdb2a3feecfd4d8af19ab66049285bedf..662b376664f3a0503b61704a60776470daaf687e 100644 |
--- a/runtime/platform/thread_win.cc |
+++ b/runtime/platform/thread_win.cc |
@@ -42,8 +42,8 @@ static unsigned int __stdcall ThreadEntry(void* data_ptr) { |
// Call the supplied thread start function handing it its parameters. |
function(parameter); |
- // When the function returns here close the handle. |
- CloseHandle(GetCurrentThread()); |
+ // Clean up the monitor wait data for this thread. |
+ MonitorWaitData::ThreadExit(); |
return 0; |
} |
@@ -173,6 +173,17 @@ void Monitor::Exit() { |
} |
+void MonitorWaitData::ThreadExit() { |
+ uword raw_wait_data = |
+ Thread::GetThreadLocal(MonitorWaitData::monitor_wait_data_key_); |
+ if (raw_wait_data != 0) { |
+ MonitorWaitData* wait_data = |
+ reinterpret_cast<MonitorWaitData*>(raw_wait_data); |
+ delete wait_data; |
+ } |
+} |
+ |
+ |
void MonitorData::AddWaiter(MonitorWaitData* wait_data) { |
// Add the MonitorWaitData object to the list of objects waiting for |
// this monitor. |