mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-29 10:54:13 +00:00
gpui: Fix use of libc::sched_param on musl (#44846)
Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
parent
c2c8b4b9fb
commit
82535a5481
1 changed files with 13 additions and 7 deletions
|
|
@ -1,18 +1,21 @@
|
|||
use crate::{
|
||||
GLOBAL_THREAD_TIMINGS, PlatformDispatcher, Priority, PriorityQueueReceiver,
|
||||
PriorityQueueSender, RealtimePriority, RunnableVariant, THREAD_TIMINGS, TaskLabel, TaskTiming,
|
||||
ThreadTaskTimings, profiler,
|
||||
};
|
||||
use calloop::{
|
||||
EventLoop, PostAction,
|
||||
channel::{self, Sender},
|
||||
timer::TimeoutAction,
|
||||
};
|
||||
use util::ResultExt;
|
||||
|
||||
use std::{
|
||||
mem::MaybeUninit,
|
||||
thread,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use util::ResultExt;
|
||||
|
||||
use crate::{
|
||||
GLOBAL_THREAD_TIMINGS, PlatformDispatcher, Priority, PriorityQueueReceiver,
|
||||
PriorityQueueSender, RealtimePriority, RunnableVariant, THREAD_TIMINGS, TaskLabel, TaskTiming,
|
||||
ThreadTaskTimings, profiler,
|
||||
};
|
||||
|
||||
struct TimerAfter {
|
||||
duration: Duration,
|
||||
|
|
@ -228,7 +231,10 @@ impl PlatformDispatcher for LinuxDispatcher {
|
|||
RealtimePriority::Other => 45,
|
||||
};
|
||||
|
||||
let sched_param = libc::sched_param { sched_priority };
|
||||
// SAFETY: all sched_param members are valid when initialized to zero.
|
||||
let mut sched_param =
|
||||
unsafe { MaybeUninit::<libc::sched_param>::zeroed().assume_init() };
|
||||
sched_param.sched_priority = sched_priority;
|
||||
// SAFETY: sched_param is a valid initialized structure
|
||||
let result = unsafe { libc::pthread_setschedparam(thread_id, policy, &sched_param) };
|
||||
if result != 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue