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..3181c7660a81478117d733bd165ef766b05a548b 100644 |
--- a/base/threading/platform_thread_linux.cc |
+++ b/base/threading/platform_thread_linux.cc |
@@ -37,8 +37,8 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = { |
{kThreadPriority_Display, -6}, |
}; |
-bool HandleSetThreadPriorityForPlatform(PlatformThreadHandle handle, |
- ThreadPriority priority) { |
+bool SetThreadPriorityForPlatform(PlatformThreadHandle handle, |
+ ThreadPriority priority) { |
#if !defined(OS_NACL) |
return priority == kThreadPriority_RealtimeAudio && |
pthread_setschedparam(pthread_self(), SCHED_RR, &kRealTimePrio) == 0; |
@@ -47,6 +47,23 @@ bool HandleSetThreadPriorityForPlatform(PlatformThreadHandle handle, |
#endif |
} |
+bool GetThreadPriorityForPlatform(PlatformThreadHandle handle, |
+ ThreadPriority* priority) { |
+#if !defined(OS_NACL) |
+ // Mirrors SetThreadPriorityForPlatform()'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 |