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

Side by Side Diff: runtime/vm/os_thread_macos.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_linux.cc ('k') | runtime/vm/os_thread_win.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_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "vm/os_thread.h" 8 #include "vm/os_thread.h"
9 9
10 #include <sys/errno.h> // NOLINT 10 #include <sys/errno.h> // NOLINT
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // exits. 81 // exits.
82 static void* ThreadStart(void* data_ptr) { 82 static void* ThreadStart(void* data_ptr) {
83 ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr); 83 ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr);
84 84
85 const char* name = data->name(); 85 const char* name = data->name();
86 OSThread::ThreadStartFunction function = data->function(); 86 OSThread::ThreadStartFunction function = data->function();
87 uword parameter = data->parameter(); 87 uword parameter = data->parameter();
88 delete data; 88 delete data;
89 89
90 // Create new OSThread object and set as TLS for new thread. 90 // Create new OSThread object and set as TLS for new thread.
91 OSThread* thread = new OSThread(); 91 OSThread* thread = OSThread::CreateOSThread();
92 OSThread::SetCurrent(thread); 92 if (thread != NULL) {
93 thread->set_name(name); 93 OSThread::SetCurrent(thread);
94 thread->set_name(name);
94 95
95 // Call the supplied thread start function handing it its parameters. 96 // Call the supplied thread start function handing it its parameters.
96 function(parameter); 97 function(parameter);
98 }
97 99
98 return NULL; 100 return NULL;
99 } 101 }
100 102
101 103
102 int OSThread::Start(const char* name, 104 int OSThread::Start(const char* name,
103 ThreadStartFunction function, 105 ThreadStartFunction function,
104 uword parameter) { 106 uword parameter) {
105 pthread_attr_t attr; 107 pthread_attr_t attr;
106 int result = pthread_attr_init(&attr); 108 int result = pthread_attr_init(&attr);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 void Monitor::NotifyAll() { 418 void Monitor::NotifyAll() {
417 // When running with assertions enabled we track the owner. 419 // When running with assertions enabled we track the owner.
418 ASSERT(IsOwnedByCurrentThread()); 420 ASSERT(IsOwnedByCurrentThread());
419 int result = pthread_cond_broadcast(data_.cond()); 421 int result = pthread_cond_broadcast(data_.cond());
420 VALIDATE_PTHREAD_RESULT(result); 422 VALIDATE_PTHREAD_RESULT(result);
421 } 423 }
422 424
423 } // namespace dart 425 } // namespace dart
424 426
425 #endif // defined(TARGET_OS_MACOS) 427 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_linux.cc ('k') | runtime/vm/os_thread_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698