Browse Source

task: fix mutex recursion when task awaiting other task ends

rdb 7 years ago
parent
commit
d1845530aa
1 changed files with 6 additions and 7 deletions
  1. 6 7
      panda/src/event/asyncTaskChain.cxx

+ 6 - 7
panda/src/event/asyncTaskChain.cxx

@@ -788,18 +788,17 @@ cleanup_task(AsyncTask *task, bool upon_death, bool clean_exit) {
 
 
   _manager->remove_task_by_name(task);
   _manager->remove_task_by_name(task);
 
 
-  if (upon_death && task->set_future_state(clean_exit ? AsyncFuture::FS_finished
-                                                      : AsyncFuture::FS_cancelled)) {
-    task->notify_done(clean_exit);
-  }
-
-  task->_manager = nullptr;
-
   if (upon_death) {
   if (upon_death) {
     _manager->_lock.unlock();
     _manager->_lock.unlock();
+    if (task->set_future_state(clean_exit ? AsyncFuture::FS_finished
+                                          : AsyncFuture::FS_cancelled)) {
+      task->notify_done(clean_exit);
+    }
     task->upon_death(_manager, clean_exit);
     task->upon_death(_manager, clean_exit);
     _manager->_lock.lock();
     _manager->_lock.lock();
   }
   }
+
+  task->_manager = nullptr;
 }
 }
 
 
 /**
 /**