提交 a459aa6c authored 作者: Serhij S's avatar Serhij S

sched convert

上级 eae532ea
...@@ -63,6 +63,19 @@ impl From<Scheduling> for libc::c_int { ...@@ -63,6 +63,19 @@ impl From<Scheduling> for libc::c_int {
} }
} }
impl From<libc::c_int> for Scheduling {
fn from(value: libc::c_int) -> Self {
match value {
libc::SCHED_RR => Scheduling::RoundRobin,
libc::SCHED_FIFO => Scheduling::FIFO,
libc::SCHED_IDLE => Scheduling::Idle,
libc::SCHED_BATCH => Scheduling::Batch,
libc::SCHED_DEADLINE => Scheduling::DeadLine,
_ => Scheduling::Normal,
}
}
}
macro_rules! impl_builder_from { macro_rules! impl_builder_from {
($t: ty) => { ($t: ty) => {
impl From<$t> for Builder { impl From<$t> for Builder {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论