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

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

Issue 6949009: Add support for real-time audio threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
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_
(...skipping 29 matching lines...) Expand all
40 const PlatformThreadHandle kNullThreadHandle = 0; 40 const PlatformThreadHandle kNullThreadHandle = 0;
41 #if defined(OS_MACOSX) 41 #if defined(OS_MACOSX)
42 typedef mach_port_t PlatformThreadId; 42 typedef mach_port_t PlatformThreadId;
43 #else // OS_POSIX && !OS_MACOSX 43 #else // OS_POSIX && !OS_MACOSX
44 typedef pid_t PlatformThreadId; 44 typedef pid_t PlatformThreadId;
45 #endif 45 #endif
46 #endif 46 #endif
47 47
48 const PlatformThreadId kInvalidThreadId = 0; 48 const PlatformThreadId kInvalidThreadId = 0;
49 49
50 // Valid values for SetThreadPriority()
51 enum ThreadPriority{
52 kThreadPriority_Normal,
53 // Suitable for low-latency, glitch-resistant audio.
54 kThreadPriority_RealtimeAudio
darin (slow to review) 2011/05/13 17:51:12 isn't it a bit unfortunate for base to have to kno
scherkus (not reviewing) 2011/05/13 23:06:49 I don't want to bikeshed this anymore, but what ab
Ken Russell (switch to Gerrit) 2011/05/13 23:11:01 The Mac implementation is currently very specific
55 };
56
50 // A namespace for low-level thread functions. 57 // A namespace for low-level thread functions.
51 class BASE_API PlatformThread { 58 class BASE_API PlatformThread {
52 public: 59 public:
53 // Implement this interface to run code on a background thread. Your 60 // Implement this interface to run code on a background thread. Your
54 // ThreadMain method will be called on the newly created thread. 61 // ThreadMain method will be called on the newly created thread.
55 class BASE_API Delegate { 62 class BASE_API Delegate {
56 public: 63 public:
57 virtual ~Delegate() {} 64 virtual ~Delegate() {}
58 virtual void ThreadMain() = 0; 65 virtual void ThreadMain() = 0;
59 }; 66 };
(...skipping 24 matching lines...) Expand all
84 // CreateNonJoinable() does the same thing as Create() except the thread 91 // CreateNonJoinable() does the same thing as Create() except the thread
85 // cannot be Join()'d. Therefore, it also does not output a 92 // cannot be Join()'d. Therefore, it also does not output a
86 // PlatformThreadHandle. 93 // PlatformThreadHandle.
87 static bool CreateNonJoinable(size_t stack_size, Delegate* delegate); 94 static bool CreateNonJoinable(size_t stack_size, Delegate* delegate);
88 95
89 // Joins with a thread created via the Create function. This function blocks 96 // Joins with a thread created via the Create function. This function blocks
90 // the caller until the designated thread exits. This will invalidate 97 // the caller until the designated thread exits. This will invalidate
91 // |thread_handle|. 98 // |thread_handle|.
92 static void Join(PlatformThreadHandle thread_handle); 99 static void Join(PlatformThreadHandle thread_handle);
93 100
101 static void SetThreadPriority(PlatformThreadHandle handle,
scherkus (not reviewing) 2011/05/13 23:06:49 could we get a comment + disclaimer here warning p
102 ThreadPriority priority);
103
94 private: 104 private:
95 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); 105 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
96 }; 106 };
97 107
98 } // namespace base 108 } // namespace base
99 109
100 #endif // BASE_THREADING_PLATFORM_THREAD_H_ 110 #endif // BASE_THREADING_PLATFORM_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | base/threading/platform_thread_mac.mm » ('j') | base/threading/platform_thread_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698