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

Side by Side Diff: runtime/vm/os_thread_win.cc

Issue 1134003005: Automatic thread cleanup on non-Windows platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/os_thread_macos.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" // NOLINT 5 #include "platform/globals.h" // NOLINT
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "vm/os_thread.h" 8 #include "vm/os_thread.h"
9 9
10 #include <process.h> // NOLINT 10 #include <process.h> // NOLINT
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Close the handle, so we don't leak the thread object. 66 // Close the handle, so we don't leak the thread object.
67 CloseHandle(reinterpret_cast<HANDLE>(thread)); 67 CloseHandle(reinterpret_cast<HANDLE>(thread));
68 68
69 return 0; 69 return 0;
70 } 70 }
71 71
72 ThreadLocalKey OSThread::kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES; 72 ThreadLocalKey OSThread::kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES;
73 ThreadId OSThread::kInvalidThreadId = 0; 73 ThreadId OSThread::kInvalidThreadId = 0;
74 74
75 ThreadLocalKey OSThread::CreateThreadLocal() { 75 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor unused) {
76 ThreadLocalKey key = TlsAlloc(); 76 ThreadLocalKey key = TlsAlloc();
77 if (key == kUnsetThreadLocalKey) { 77 if (key == kUnsetThreadLocalKey) {
78 FATAL1("TlsAlloc failed %d", GetLastError()); 78 FATAL1("TlsAlloc failed %d", GetLastError());
79 } 79 }
80 return key; 80 return key;
81 } 81 }
82 82
83 83
84 void OSThread::DeleteThreadLocal(ThreadLocalKey key) { 84 void OSThread::DeleteThreadLocal(ThreadLocalKey key) {
85 ASSERT(key != kUnsetThreadLocalKey); 85 ASSERT(key != kUnsetThreadLocalKey);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // timeout before we signal it, that object will get an extra 451 // timeout before we signal it, that object will get an extra
452 // signal. This will be treated as a spurious wake-up and is OK 452 // signal. This will be treated as a spurious wake-up and is OK
453 // since all uses of monitors should recheck the condition after a 453 // since all uses of monitors should recheck the condition after a
454 // Wait. 454 // Wait.
455 data_.SignalAndRemoveAllWaiters(); 455 data_.SignalAndRemoveAllWaiters();
456 } 456 }
457 457
458 } // namespace dart 458 } // namespace dart
459 459
460 #endif // defined(TARGET_OS_WINDOWS) 460 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_macos.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698