40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
backport of https://github.com/padenot/audio_thread_priority/commit/b5b86285d3c0cae2cb731730460f386ffa30cb03.patch
|
|
avoids problems with serialization of RtPriorityThreadInfo in media/audioipc on musl
|
|
|
|
--- third_party/rust/audio_thread_priority/src/rt_linux.rs 2019-12-02 13:24:01.000000000 +0100
|
|
+++ third_party/rust/audio_thread_priority/src/rt_linux.rs 2019-12-02 13:24:01.000000000 +0100
|
|
@@ -31,9 +31,7 @@
|
|
/// process.
|
|
pthread_id: libc::pthread_t,
|
|
/// ...
|
|
- policy: libc::c_int,
|
|
- /// ...
|
|
- param: libc::sched_param,
|
|
+ policy: libc::c_int
|
|
}
|
|
|
|
impl RtPriorityThreadInfoInternal {
|
|
@@ -141,9 +139,11 @@
|
|
-> Result<(), ()> {
|
|
assert!(unsafe { libc::pthread_self() } == rt_priority_handle.thread_info.pthread_id);
|
|
|
|
+ let param = unsafe { std::mem::zeroed::<libc::sched_param>() };
|
|
+
|
|
if unsafe { libc::pthread_setschedparam(rt_priority_handle.thread_info.pthread_id,
|
|
rt_priority_handle.thread_info.policy,
|
|
- &rt_priority_handle.thread_info.param) } < 0 {
|
|
+ ¶m) } < 0 {
|
|
error!("could not demote thread {}", OSError::last_os_error().raw_os_error().unwrap());
|
|
return Err(());
|
|
}
|
|
@@ -187,8 +187,7 @@
|
|
pid,
|
|
thread_id,
|
|
pthread_id,
|
|
- policy,
|
|
- param
|
|
+ policy
|
|
})
|
|
}
|
|
|