Skip to content

Commit

Permalink
feat(s2n-quic-dc): name the path::secret::map::Cleaner thread (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Nov 26, 2024
1 parent c84ba19 commit db310ba
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions dc/s2n-quic-dc/src/path/secret/map/cleaner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,21 @@ impl Cleaner {
S: event::Subscriber,
{
let state = Arc::downgrade(&state);
let handle = std::thread::spawn(move || loop {
let Some(state) = state.upgrade() else {
break;
};
if state.cleaner().should_stop.load(Ordering::Relaxed) {
break;
}
state.cleaner().clean(&state, EVICTION_CYCLES);
let pause = rand::thread_rng().gen_range(5..60);
drop(state);
std::thread::park_timeout(Duration::from_secs(pause));
});
let handle = std::thread::Builder::new()
.name("dc_quic::cleaner".into())
.spawn(move || loop {
let Some(state) = state.upgrade() else {
break;
};
if state.cleaner().should_stop.load(Ordering::Relaxed) {
break;
}
state.cleaner().clean(&state, EVICTION_CYCLES);
let pause = rand::thread_rng().gen_range(5..60);
drop(state);
std::thread::park_timeout(Duration::from_secs(pause));
})
.unwrap();
*self.thread.lock().unwrap() = Some(handle);
}

Expand Down

0 comments on commit db310ba

Please sign in to comment.