| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/threading/platform_thread.h" | 5 #include "base/threading/platform_thread.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <mach/mach.h> | 9 #include <mach/mach.h> |
| 10 #include <mach/mach_time.h> | 10 #include <mach/mach_time.h> |
| 11 #include <mach/thread_policy.h> | 11 #include <mach/thread_policy.h> |
| 12 | 12 |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/threading/thread_local.h" | 15 #include "base/threading/thread_local.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 LazyInstance<ThreadLocalPointer<char>, | 21 LazyInstance<ThreadLocalPointer<char>, |
| 22 LeakyLazyInstanceTraits<ThreadLocalPointer<char> > > | 22 LeakyLazyInstanceTraits<ThreadLocalPointer<char> > > |
| 23 current_thread_name(LINKER_INITIALIZED); | 23 current_thread_name = LINKER_ZERO_INITIALIZED; |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 // If Cocoa is to be used on more than one thread, it must know that the | 27 // If Cocoa is to be used on more than one thread, it must know that the |
| 28 // application is multithreaded. Since it's possible to enter Cocoa code | 28 // application is multithreaded. Since it's possible to enter Cocoa code |
| 29 // from threads created by pthread_thread_create, Cocoa won't necessarily | 29 // from threads created by pthread_thread_create, Cocoa won't necessarily |
| 30 // be aware that the application is multithreaded. Spawning an NSThread is | 30 // be aware that the application is multithreaded. Spawning an NSThread is |
| 31 // enough to get Cocoa to set up for multithreaded operation, so this is done | 31 // enough to get Cocoa to set up for multithreaded operation, so this is done |
| 32 // if necessary before pthread_thread_create spawns any threads. | 32 // if necessary before pthread_thread_create spawns any threads. |
| 33 // | 33 // |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 case kThreadPriority_Normal: | 180 case kThreadPriority_Normal: |
| 181 SetPriorityNormal(mach_thread_id); | 181 SetPriorityNormal(mach_thread_id); |
| 182 break; | 182 break; |
| 183 case kThreadPriority_RealtimeAudio: | 183 case kThreadPriority_RealtimeAudio: |
| 184 SetPriorityRealtimeAudio(mach_thread_id); | 184 SetPriorityRealtimeAudio(mach_thread_id); |
| 185 break; | 185 break; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace base | 189 } // namespace base |
| OLD | NEW |