From a59c9e655bdbb8551affb27e7f4ca7e339d6f240 Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Tue, 31 Oct 2023 09:41:31 -0500 Subject: [PATCH] RDC crash when exit Join the signal handling thread instead of cancel it to prevent crash with "terminate called without an active exception". Change-Id: I2e18eb825728fd3a94f67b1b0049516bb7b6ebbc [ROCm/rdc commit: 1ab4110d465540124b88584daea064b30f4d1ec6] --- projects/rdc/server/src/rdc_server_main.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/rdc/server/src/rdc_server_main.cc b/projects/rdc/server/src/rdc_server_main.cc index 445a9e2933..b7fb3610ee 100755 --- a/projects/rdc/server/src/rdc_server_main.cc +++ b/projects/rdc/server/src/rdc_server_main.cc @@ -696,12 +696,14 @@ int main(int argc, char** argv) { rdc_server.Run(); - thr_ret = pthread_cancel(sig_listen_thread); + // join the thread to prevent the program terminated + void* ret = nullptr; + thr_ret = pthread_join(sig_listen_thread, &ret); // don't fail if it doesn't succeed - if (thr_ret) { + if (thr_ret != 0) { std::cerr << - "Failed to terminate ProcessSignalLoop. pthread_cancel() returned " << + "Failed to terminate ProcessSignalLoop. pthread_join() returned " << thr_ret; }