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

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

Issue 1537543002: Fix for issue 25236 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years 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
« 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // exits. 90 // exits.
91 static void* ThreadStart(void* data_ptr) { 91 static void* ThreadStart(void* data_ptr) {
92 ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr); 92 ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr);
93 93
94 const char* name = data->name(); 94 const char* name = data->name();
95 OSThread::ThreadStartFunction function = data->function(); 95 OSThread::ThreadStartFunction function = data->function();
96 uword parameter = data->parameter(); 96 uword parameter = data->parameter();
97 delete data; 97 delete data;
98 98
99 // Create new OSThread object and set as TLS for new thread. 99 // Create new OSThread object and set as TLS for new thread.
100 OSThread* thread = new OSThread(); 100 OSThread* thread = OSThread::CreateOSThread();
101 OSThread::SetCurrent(thread); 101 if (thread != NULL) {
102 thread->set_name(name); 102 OSThread::SetCurrent(thread);
103 thread->set_name(name);
103 104
104 // Call the supplied thread start function handing it its parameters. 105 // Call the supplied thread start function handing it its parameters.
105 function(parameter); 106 function(parameter);
107 }
106 108
107 return NULL; 109 return NULL;
108 } 110 }
109 111
110 112
111 int OSThread::Start(const char* name, 113 int OSThread::Start(const char* name,
112 ThreadStartFunction function, 114 ThreadStartFunction function,
113 uword parameter) { 115 uword parameter) {
114 pthread_attr_t attr; 116 pthread_attr_t attr;
115 int result = pthread_attr_init(&attr); 117 int result = pthread_attr_init(&attr);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 void Monitor::NotifyAll() { 415 void Monitor::NotifyAll() {
414 // When running with assertions enabled we track the owner. 416 // When running with assertions enabled we track the owner.
415 ASSERT(IsOwnedByCurrentThread()); 417 ASSERT(IsOwnedByCurrentThread());
416 int result = pthread_cond_broadcast(data_.cond()); 418 int result = pthread_cond_broadcast(data_.cond());
417 VALIDATE_PTHREAD_RESULT(result); 419 VALIDATE_PTHREAD_RESULT(result);
418 } 420 }
419 421
420 } // namespace dart 422 } // namespace dart
421 423
422 #endif // defined(TARGET_OS_LINUX) 424 #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