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

Side by Side Diff: base/threading/simple_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 probably be using Thread (thread.h) instead. Thread is 5 // WARNING: You should probably be using Thread (thread.h) instead. Thread is
6 // Chrome's message-loop based Thread abstraction, and if you are a 6 // Chrome's message-loop based Thread abstraction, and if you are a
7 // thread running in the browser, there will likely be assumptions 7 // thread running in the browser, there will likely be assumptions
8 // that your thread will have an associated message loop. 8 // that your thread will have an associated message loop.
9 // 9 //
10 // This is a simple thread interface that backs to a native operating system 10 // This is a simple thread interface that backs to a native operating system
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Return True if Start() has ever been called. 98 // Return True if Start() has ever been called.
99 bool HasBeenStarted() { return event_.IsSignaled(); } 99 bool HasBeenStarted() { return event_.IsSignaled(); }
100 100
101 // Return True if Join() has evern been called. 101 // Return True if Join() has evern been called.
102 bool HasBeenJoined() { return joined_; } 102 bool HasBeenJoined() { return joined_; }
103 103
104 // Overridden from PlatformThread::Delegate: 104 // Overridden from PlatformThread::Delegate:
105 virtual void ThreadMain(); 105 virtual void ThreadMain();
106 106
107 void SetThreadPriority(ThreadPriority priority) {
108 PlatformThread::SetThreadPriority(thread_, priority);
109 }
110
107 private: 111 private:
108 const std::string name_prefix_; 112 const std::string name_prefix_;
109 std::string name_; 113 std::string name_;
110 const Options options_; 114 const Options options_;
111 PlatformThreadHandle thread_; // PlatformThread handle, invalid after Join! 115 PlatformThreadHandle thread_; // PlatformThread handle, invalid after Join!
112 WaitableEvent event_; // Signaled if Start() was ever called. 116 WaitableEvent event_; // Signaled if Start() was ever called.
113 PlatformThreadId tid_; // The backing thread's id. 117 PlatformThreadId tid_; // The backing thread's id.
114 bool joined_; // True if Join has been called. 118 bool joined_; // True if Join has been called.
115 }; 119 };
116 120
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 int num_threads_; 179 int num_threads_;
176 std::vector<DelegateSimpleThread*> threads_; 180 std::vector<DelegateSimpleThread*> threads_;
177 std::queue<Delegate*> delegates_; 181 std::queue<Delegate*> delegates_;
178 base::Lock lock_; // Locks delegates_ 182 base::Lock lock_; // Locks delegates_
179 WaitableEvent dry_; // Not signaled when there is no work to do. 183 WaitableEvent dry_; // Not signaled when there is no work to do.
180 }; 184 };
181 185
182 } // namespace base 186 } // namespace base
183 187
184 #endif // BASE_THREADING_SIMPLE_THREAD_H_ 188 #endif // BASE_THREADING_SIMPLE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698