fast exit dynamic test

This commit is contained in:
Anatoly Yakovenko
2018-07-16 22:22:29 -07:00
committed by Greg Fitzgerald
parent 47a22c66b4
commit 72282dc493
2 changed files with 8 additions and 0 deletions

View File

@ -318,6 +318,10 @@ impl FullNode {
FullNode { exit, thread_hdls }
}
//used for notifying many nodes in parallel to exit
pub fn notify_exit(self) {
self.exit.store(true, Ordering::Relaxed);
}
pub fn close(self) -> Result<()> {
self.exit.store(true, Ordering::Relaxed);
self.join()
@ -355,6 +359,7 @@ mod tests {
let exit = Arc::new(AtomicBool::new(false));
let entry = tn.data.clone();
let v = FullNode::new_validator(kp, bank, 0, None, tn, &entry, exit);
v.notify_exit();
v.close().unwrap();
}
}