Merge pull request #622 from fufesou/fix_deadlock_general_service

fix_deadlock_general_service
This commit is contained in:
RustDesk 2022-05-26 17:17:56 +08:00 committed by GitHub
commit 223a4f2323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,12 @@ impl<T: Subscriber + From<ConnInner>> Service for ServiceTmpl<T> {
fn join(&self) {
self.0.write().unwrap().active = false;
self.0.write().unwrap().handle.take().map(JoinHandle::join);
let handle = self.0.write().unwrap().handle.take();
if let Some(handle) = handle {
if let Err(e) = handle.join() {
log::error!("Failed to join thread for service {}, {:?}", self.name(), e);
}
}
}
}