Browse Source

pipeline: Display error if joining thread failed

This can occur if a thread tries to call join on itself
rdb 3 years ago
parent
commit
863a38e901
1 changed files with 6 additions and 1 deletions
  1. 6 1
      panda/src/pipeline/threadPosixImpl.cxx

+ 6 - 1
panda/src/pipeline/threadPosixImpl.cxx

@@ -169,7 +169,12 @@ join() {
   if (!_detached) {
     _mutex.unlock();
     void *return_val;
-    pthread_join(_thread, &return_val);
+    int result = pthread_join(_thread, &return_val);
+    if (result != 0) {
+      thread_cat.error()
+        << "Failed to join thread " << _parent_obj->get_name()
+        << ": " << strerror(result) << "\n";
+    }
     _detached = true;
     return;
   }