Skip to content

Commit

Permalink
Merge pull request #901 from DenisBiryukov91/fix/ZRuntime_drop
Browse files Browse the repository at this point in the history
fix ZRuntimePool drop crash if not all runtimes were initialized
  • Loading branch information
milyin authored Apr 4, 2024
2 parents 6799a92 + f419da8 commit 1f8dbe4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions commons/zenoh-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,9 @@ impl Drop for ZRuntimePool {
let handles: Vec<_> = self
.0
.drain()
.map(|(name, mut rt)| {
std::thread::spawn(move || {
rt.take()
.unwrap_or_else(|| panic!("ZRuntime {name:?} failed to shutdown."))
.shutdown_timeout(Duration::from_secs(1))
})
.filter_map(|(_name, mut rt)| {
rt.take()
.map(|r| std::thread::spawn(move || r.shutdown_timeout(Duration::from_secs(1))))
})
.collect();

Expand Down

0 comments on commit 1f8dbe4

Please sign in to comment.