Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1043)

Unified Diff: runtime/vm/os_thread_win.cc

Issue 1760673002: Fix windows build break. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread_win.cc
diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc
index 3802a1633900b8e0df5205cc0eecff6e4a314f24..9d282bc2f8132d8046338fc320c7e9bba701b9a5 100644
--- a/runtime/vm/os_thread_win.cc
+++ b/runtime/vm/os_thread_win.cc
@@ -6,6 +6,7 @@
#if defined(TARGET_OS_WINDOWS)
#include "vm/growable_array.h"
+#include "vm/lockers.h"
#include "vm/os_thread.h"
#include <process.h> // NOLINT
@@ -565,7 +566,7 @@ void ThreadLocalData::AddThreadLocal(ThreadLocalKey key,
// We only care about thread locals with destructors.
return;
}
- mutex_->Lock();
+ MutexLocker ml(mutex_, false);
#if defined(DEBUG)
// Verify that we aren't added twice.
for (intptr_t i = 0; i < thread_locals_->length(); i++) {
@@ -575,12 +576,12 @@ void ThreadLocalData::AddThreadLocal(ThreadLocalKey key,
#endif
// Add to list.
thread_locals_->Add(ThreadLocalEntry(key, destructor));
- mutex_->Unlock();
}
void ThreadLocalData::RemoveThreadLocal(ThreadLocalKey key) {
- ASSERT(thread_locals_ != NULL); mutex_->Lock();
+ ASSERT(thread_locals_ != NULL);
+ MutexLocker ml(mutex_, false);
intptr_t i = 0;
for (; i < thread_locals_->length(); i++) {
const ThreadLocalEntry& entry = thread_locals_->At(i);
@@ -590,11 +591,9 @@ void ThreadLocalData::RemoveThreadLocal(ThreadLocalKey key) {
}
if (i == thread_locals_->length()) {
// Not found.
- mutex_->Unlock();
return;
}
thread_locals_->RemoveAt(i);
- mutex_->Unlock();
}
@@ -603,7 +602,7 @@ void ThreadLocalData::RemoveThreadLocal(ThreadLocalKey key) {
void ThreadLocalData::RunDestructors() {
ASSERT(thread_locals_ != NULL);
ASSERT(mutex_ != NULL);
- mutex_->Lock();
+ MutexLocker ml(mutex_, false);
for (intptr_t i = 0; i < thread_locals_->length(); i++) {
const ThreadLocalEntry& entry = thread_locals_->At(i);
// We access the exiting thread's TLS variable here.
@@ -611,7 +610,6 @@ void ThreadLocalData::RunDestructors() {
// We invoke the constructor here.
entry.destructor()(p);
}
- mutex_->Unlock();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698