Revert 8810 "- Add a SetPriority method to ThreadWrapper"
Seeing if this is causing roll issues. > - Add a SetPriority method to ThreadWrapper > - Remove 'priority' from CreateThread and related member variables from implementations > - Make supplying a name for threads, non-optional > > BUG= > R=magjed@webrtc.org > > Review URL: https://webrtc-codereview.appspot.com/44729004 TBR=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/48609004 Cr-Commit-Position: refs/heads/master@{#8818} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8818 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -55,9 +55,10 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) {
|
||||
}
|
||||
|
||||
ThreadWindows::ThreadWindows(ThreadRunFunction func, void* obj,
|
||||
const char* thread_name)
|
||||
ThreadPriority prio, const char* thread_name)
|
||||
: run_function_(func),
|
||||
obj_(obj),
|
||||
prio_(prio),
|
||||
stop_(false),
|
||||
thread_(NULL),
|
||||
name_(thread_name ? thread_name : "webrtc") {
|
||||
@ -97,6 +98,28 @@ bool ThreadWindows::Start() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (prio_ != kNormalPriority) {
|
||||
int priority = THREAD_PRIORITY_NORMAL;
|
||||
switch (prio_) {
|
||||
case kLowPriority:
|
||||
priority = THREAD_PRIORITY_BELOW_NORMAL;
|
||||
break;
|
||||
case kHighPriority:
|
||||
priority = THREAD_PRIORITY_ABOVE_NORMAL;
|
||||
break;
|
||||
case kHighestPriority:
|
||||
priority = THREAD_PRIORITY_HIGHEST;
|
||||
break;
|
||||
case kRealtimePriority:
|
||||
priority = THREAD_PRIORITY_TIME_CRITICAL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SetThreadPriority(thread_, priority);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -113,11 +136,6 @@ bool ThreadWindows::Stop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ThreadWindows::SetPriority(ThreadPriority priority) {
|
||||
DCHECK(main_thread_.CalledOnValidThread());
|
||||
return thread_ && SetThreadPriority(thread_, priority);
|
||||
}
|
||||
|
||||
void ThreadWindows::Run() {
|
||||
if (!name_.empty())
|
||||
SetThreadName(static_cast<DWORD>(-1), name_.c_str());
|
||||
|
||||
Reference in New Issue
Block a user