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

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

Powered by Google App Engine
This is Rietveld 408576698