Skip to content

Commit

Permalink
Cfg set priority for vxworks
Browse files Browse the repository at this point in the history
  • Loading branch information
biabbas committed Oct 18, 2024
1 parent e8c8c2c commit 2777c8f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,15 @@ pub fn set_thread_priority_and_policy(
set_errno(0);
// VxWorks does not have setpriority function call. Control never
// reaches this statement because of the cfg condition in if
#[cfg(not(target_os = "vxworks"))]
let ret = unsafe { libc::setpriority(libc::PRIO_PROCESS, 0, fixed_priority) };
if ret != 0 {
return Err(Error::OS(errno()));
cfg_if::cfg_if!{
if #[cfg(target_os = "vxworks")]{
return Err(Error::Priority("Could not set priority as set priority is not available on vxworks"));
} else{
let ret = unsafe { libc::setpriority(libc::PRIO_PROCESS, 0, fixed_priority) };
if ret != 0 {
return Err(Error::OS(errno()));
}
}
}

Ok(())
Expand Down

0 comments on commit 2777c8f

Please sign in to comment.