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

Unified Diff: base/threading/platform_thread_linux.cc

Issue 434803003: Linux, Android: fix call to setpriority(2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: base/threading/platform_thread_linux.cc
diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
index 636e13331c4e245a733ef313fc2b749282aad39d..ec4c8916eb531682f0f5df1db97aaec8204f832c 100644
--- a/base/threading/platform_thread_linux.cc
+++ b/base/threading/platform_thread_linux.cc
@@ -82,13 +82,13 @@ void PlatformThread::SetThreadPriority(PlatformThreadHandle handle,
}
}
- // setpriority(2) will set a thread's priority if it is passed a tid as
- // the 'process identifier', not affecting the rest of the threads in the
- // process. Setting this priority will only succeed if the user has been
- // granted permission to adjust nice values on the system.
+ // setpriority(2) should change the whole thread group's (i.e. process)
+ // priority. However, on Linux it will only change the current thread. See
+ // the BUGs section in
+ // http://man7.org/linux/man-pages/man2/getpriority.2.html.
DCHECK_NE(handle.id_, kInvalidThreadId);
const int kNiceSetting = ThreadNiceValue(priority);
- if (setpriority(PRIO_PROCESS, handle.id_, kNiceSetting)) {
+ if (setpriority(PRIO_PROCESS, 0, kNiceSetting)) {
DVPLOG(1) << "Failed to set nice value of thread ("
<< handle.id_ << ") to " << kNiceSetting;
}
« base/threading/platform_thread_android.cc ('K') | « base/threading/platform_thread_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698