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

Side by Side Diff: runtime/vm/os_thread_linux.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_android.cc ('k') | runtime/vm/os_thread_macos.cc » ('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_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include "vm/os_thread.h" 8 #include "vm/os_thread.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 RETURN_ON_PTHREAD_FAILURE(result); 110 RETURN_ON_PTHREAD_FAILURE(result);
111 111
112 return 0; 112 return 0;
113 } 113 }
114 114
115 115
116 ThreadLocalKey OSThread::kUnsetThreadLocalKey = 116 ThreadLocalKey OSThread::kUnsetThreadLocalKey =
117 static_cast<pthread_key_t>(-1); 117 static_cast<pthread_key_t>(-1);
118 ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); 118 ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0);
119 119
120 ThreadLocalKey OSThread::CreateThreadLocal() { 120 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) {
121 pthread_key_t key = kUnsetThreadLocalKey; 121 pthread_key_t key = kUnsetThreadLocalKey;
122 int result = pthread_key_create(&key, NULL); 122 int result = pthread_key_create(&key, destructor);
123 VALIDATE_PTHREAD_RESULT(result); 123 VALIDATE_PTHREAD_RESULT(result);
124 ASSERT(key != kUnsetThreadLocalKey); 124 ASSERT(key != kUnsetThreadLocalKey);
125 return key; 125 return key;
126 } 126 }
127 127
128 128
129 void OSThread::DeleteThreadLocal(ThreadLocalKey key) { 129 void OSThread::DeleteThreadLocal(ThreadLocalKey key) {
130 ASSERT(key != kUnsetThreadLocalKey); 130 ASSERT(key != kUnsetThreadLocalKey);
131 int result = pthread_key_delete(key); 131 int result = pthread_key_delete(key);
132 VALIDATE_PTHREAD_RESULT(result); 132 VALIDATE_PTHREAD_RESULT(result);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 void Monitor::NotifyAll() { 343 void Monitor::NotifyAll() {
344 // TODO(iposva): Do we need to track lock owners? 344 // TODO(iposva): Do we need to track lock owners?
345 int result = pthread_cond_broadcast(data_.cond()); 345 int result = pthread_cond_broadcast(data_.cond());
346 VALIDATE_PTHREAD_RESULT(result); 346 VALIDATE_PTHREAD_RESULT(result);
347 } 347 }
348 348
349 } // namespace dart 349 } // namespace dart
350 350
351 #endif // defined(TARGET_OS_LINUX) 351 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_android.cc ('k') | runtime/vm/os_thread_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698