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

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

Issue 10151009: Disallow UI/IO thread blocking on any other thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « base/threading/sequenced_worker_pool.cc ('k') | base/threading/simple_thread.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 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Return the thread name prefix, or "unnamed" if none was supplied. 90 // Return the thread name prefix, or "unnamed" if none was supplied.
91 std::string name_prefix() { return name_prefix_; } 91 std::string name_prefix() { return name_prefix_; }
92 92
93 // Return the completed name including TID, only valid after Start(). 93 // Return the completed name including TID, only valid after Start().
94 std::string name() { return name_; } 94 std::string name() { return name_; }
95 95
96 // Return the thread id, only valid after Start(). 96 // Return the thread id, only valid after Start().
97 PlatformThreadId tid() { return tid_; } 97 PlatformThreadId tid() { return tid_; }
98 98
99 // Return True if Start() has ever been called. 99 // Return True if Start() has ever been called.
100 bool HasBeenStarted() { return event_.IsSignaled(); } 100 bool HasBeenStarted();
101 101
102 // Return True if Join() has evern been called. 102 // Return True if Join() has evern been called.
103 bool HasBeenJoined() { return joined_; } 103 bool HasBeenJoined() { return joined_; }
104 104
105 // Overridden from PlatformThread::Delegate: 105 // Overridden from PlatformThread::Delegate:
106 virtual void ThreadMain() OVERRIDE; 106 virtual void ThreadMain() OVERRIDE;
107 107
108 // Only set priorities with a careful understanding of the consequences. 108 // Only set priorities with a careful understanding of the consequences.
109 // This is meant for very limited use cases. 109 // This is meant for very limited use cases.
110 void SetThreadPriority(ThreadPriority priority) { 110 void SetThreadPriority(ThreadPriority priority) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 int num_threads_; 182 int num_threads_;
183 std::vector<DelegateSimpleThread*> threads_; 183 std::vector<DelegateSimpleThread*> threads_;
184 std::queue<Delegate*> delegates_; 184 std::queue<Delegate*> delegates_;
185 base::Lock lock_; // Locks delegates_ 185 base::Lock lock_; // Locks delegates_
186 WaitableEvent dry_; // Not signaled when there is no work to do. 186 WaitableEvent dry_; // Not signaled when there is no work to do.
187 }; 187 };
188 188
189 } // namespace base 189 } // namespace base
190 190
191 #endif // BASE_THREADING_SIMPLE_THREAD_H_ 191 #endif // BASE_THREADING_SIMPLE_THREAD_H_
OLDNEW
« no previous file with comments | « base/threading/sequenced_worker_pool.cc ('k') | base/threading/simple_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698