Skip to content

Commit 41a0bd4

Browse files
committed
dut_power: make the ThreadPriorityValue conversion fallible
Signed-off-by: Leonard Göhrs <[email protected]>
1 parent c06a7b4 commit 41a0bd4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dut_power.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ mod prio {
5050
use thread_priority::*;
5151

5252
pub fn realtime_priority() -> Result<()> {
53+
let prio = ThreadPriorityValue::try_from(10)
54+
.map_err(|e| anyhow!("Failed to choose realtime priority level 10: {e:?}"))?;
55+
5356
set_thread_priority_and_policy(
5457
thread_native_id(),
55-
ThreadPriority::Crossplatform(ThreadPriorityValue::try_from(10).unwrap()),
58+
ThreadPriority::Crossplatform(prio),
5659
ThreadSchedulePolicy::Realtime(RealtimeThreadSchedulePolicy::Fifo),
5760
)
5861
.map_err(|e| anyhow!("Failed to set up realtime priority {e:?}"))

0 commit comments

Comments
 (0)