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
This commit is contained in:
Bill(Shuzhou) Liu
2023-10-31 09:41:31 -05:00
committed by Shuzhou Liu
parent e579cb04b2
commit 1ab4110d46
+5 -3
View File
@@ -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;
}