Index: base/threading/platform_thread_freebsd.cc |
diff --git a/base/threading/platform_thread_freebsd.cc b/base/threading/platform_thread_freebsd.cc |
index a163f650443d08f1602ff295e8c985dab7c7ddd2..0d98e998c8e35671a3ecfe97f4bab0e98091d728 100644 |
--- a/base/threading/platform_thread_freebsd.cc |
+++ b/base/threading/platform_thread_freebsd.cc |
@@ -36,9 +36,11 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = { |
{ kThreadPriority_Display, -6 }, |
} |
-bool HandleSetThreadPriorityForPlatform(PlatformThreadHandle handle, |
- ThreadPriority priority) { |
+bool SetThreadPriorityForPlatform(PlatformThreadHandle handle, |
+ ThreadPriority priority) { |
#if !defined(OS_NACL) |
+ // TODO: Assess the correctness of using |pthread_self()| below instead of |
+ // |handle|. http://crbug.com/468793. |
return priority == kThreadPriority_RealtimeAudio && |
pthread_setschedparam(pthread_self(), SCHED_RR, &kRealTimePrio) == 0; |
#else |
@@ -46,6 +48,24 @@ bool HandleSetThreadPriorityForPlatform(PlatformThreadHandle handle, |
#endif |
} |
+bool GetThreadPriorityForPlatform(PlatformThreadHandle handle, |
+ ThreadPriority* priority) { |
+#if !defined(OS_NACL) |
+ // TODO: Assess the correctness of using |pthread_self()| below instead of |
rvargas (doing something else)
2015/03/31 22:43:45
nit: add a name (no, the name on a TODO is not mea
gab
2015/04/01 01:14:39
Done.
|
+ // |handle|. http://crbug.com/468793. |
+ 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 |