Skip to content

Commit 44630a4

Browse files
authored
Merge pull request #2154 from EricccTaiwan/chaos-refactor
scx_chaos: Refactor stats_thread initialization using map()
2 parents bb6eeb4 + f415392 commit 44630a4

File tree

1 file changed

+4
-6
lines changed
  • scheds/rust/scx_chaos/src

1 file changed

+4
-6
lines changed

scheds/rust/scx_chaos/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,13 @@ pub fn run(args: Args) -> Result<()> {
710710
return stats::monitor(Duration::from_secs_f64(intv), shutdown);
711711
}
712712

713-
let stats_thread = if let Some(intv) = args.stats {
713+
let stats_thread = args.stats.map(|intv| {
714714
let shutdown = shutdown.clone();
715715

716-
Some(thread::spawn(move || -> Result<()> {
716+
thread::spawn(move || -> Result<()> {
717717
stats::monitor(Duration::from_secs_f64(intv), shutdown)
718-
}))
719-
} else {
720-
None
721-
};
718+
})
719+
});
722720

723721
let scheduler_thread = thread::spawn({
724722
let args = args.clone();

0 commit comments

Comments
 (0)