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

Side by Side Diff: base/threading/platform_thread.h

Issue 9281011: [Mac] In PlatformThread::CurrentId(), use pthread_self() instead of mach_thread_self(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 11 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 | « no previous file | base/threading/platform_thread_posix.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) 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 // WARNING: You should *NOT* be using this class directly. PlatformThread is 5 // WARNING: You should *NOT* be using this class directly. PlatformThread is
6 // the low-level platform-specific abstraction to the OS's threading interface. 6 // the low-level platform-specific abstraction to the OS's threading interface.
7 // You should instead be using a message-loop driven Thread, see thread.h. 7 // You should instead be using a message-loop driven Thread, see thread.h.
8 8
9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_ 9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_
10 #define BASE_THREADING_PLATFORM_THREAD_H_ 10 #define BASE_THREADING_PLATFORM_THREAD_H_
11 #pragma once 11 #pragma once
12 12
13 #include "base/base_export.h" 13 #include "base/base_export.h"
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 17
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 #include <windows.h> 19 #include <windows.h>
20 #elif defined(OS_POSIX) 20 #elif defined(OS_POSIX)
21 #include <pthread.h> 21 #include <pthread.h>
22 #if defined(OS_MACOSX)
23 #include <mach/mach.h>
24 #else // OS_POSIX && !OS_MACOSX
25 #include <unistd.h> 22 #include <unistd.h>
26 #endif 23 #endif
27 #endif
28 24
29 namespace base { 25 namespace base {
30 26
31 // PlatformThreadHandle should not be assumed to be a numeric type, since the 27 // PlatformThreadHandle should not be assumed to be a numeric type, since the
32 // standard intends to allow pthread_t to be a structure. This means you 28 // standard intends to allow pthread_t to be a structure. This means you
33 // should not initialize it to a value, like 0. If it's a member variable, the 29 // should not initialize it to a value, like 0. If it's a member variable, the
34 // constructor can safely "value initialize" using () in the initializer list. 30 // constructor can safely "value initialize" using () in the initializer list.
35 #if defined(OS_WIN) 31 #if defined(OS_WIN)
36 typedef DWORD PlatformThreadId; 32 typedef DWORD PlatformThreadId;
37 typedef void* PlatformThreadHandle; // HANDLE 33 typedef void* PlatformThreadHandle; // HANDLE
38 const PlatformThreadHandle kNullThreadHandle = NULL; 34 const PlatformThreadHandle kNullThreadHandle = NULL;
39 #elif defined(OS_POSIX) 35 #elif defined(OS_POSIX)
40 typedef pthread_t PlatformThreadHandle; 36 typedef pthread_t PlatformThreadHandle;
41 const PlatformThreadHandle kNullThreadHandle = 0; 37 const PlatformThreadHandle kNullThreadHandle = 0;
42 #if defined(OS_MACOSX)
43 typedef mach_port_t PlatformThreadId;
44 #else // OS_POSIX && !OS_MACOSX
45 typedef pid_t PlatformThreadId; 38 typedef pid_t PlatformThreadId;
46 #endif 39 #endif
47 #endif
48 40
49 const PlatformThreadId kInvalidThreadId = 0; 41 const PlatformThreadId kInvalidThreadId = 0;
50 42
51 // Valid values for SetThreadPriority() 43 // Valid values for SetThreadPriority()
52 enum ThreadPriority{ 44 enum ThreadPriority{
53 kThreadPriority_Normal, 45 kThreadPriority_Normal,
54 // Suitable for low-latency, glitch-resistant audio. 46 // Suitable for low-latency, glitch-resistant audio.
55 kThreadPriority_RealtimeAudio 47 kThreadPriority_RealtimeAudio
56 }; 48 };
57 49
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 static void SetThreadPriority(PlatformThreadHandle handle, 102 static void SetThreadPriority(PlatformThreadHandle handle,
111 ThreadPriority priority); 103 ThreadPriority priority);
112 104
113 private: 105 private:
114 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); 106 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
115 }; 107 };
116 108
117 } // namespace base 109 } // namespace base
118 110
119 #endif // BASE_THREADING_PLATFORM_THREAD_H_ 111 #endif // BASE_THREADING_PLATFORM_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | base/threading/platform_thread_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698