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

Unified Diff: base/threading/platform_thread_linux.cc

Issue 1006933003: Add full SetThreadPriority support to Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 623a3dee678352aaf8a61b402c431a1727aa2fd9..5f9e83336c48b1ed95d860a135fd78f071403a80 100644
--- a/base/threading/platform_thread_linux.cc
+++ b/base/threading/platform_thread_linux.cc
@@ -47,6 +47,23 @@ bool HandleSetThreadPriorityForPlatform(PlatformThreadHandle handle,
#endif
}
+bool HandleGetThreadPriorityForPlatform(PlatformThreadHandle handle,
+ ThreadPriority* priority) {
+#if !defined(OS_NACL)
+ // Mirrors HandleSetThreadPriorityForPlatform()'s implementation.
+ int maybe_sched_rr = 0;
+ struct sched_param maybe_realtime_prio = {0};
+ if (pthread_getschedparam(pthread_self(), &maybe_sched_rr,
+ &maybe_realtime_prio) == 0 &&
+ maybe_sched_rr == SCHED_RR &&
+ maybe_realtime_prio.sched_priority == kRealTimePrio.sched_priority) {
+ *priority = kThreadPriority_RealtimeAudio;
+ return true;
+ }
+#endif
+ return false;
+}
+
} // namespace internal
// static

Powered by Google App Engine
This is Rietveld 408576698