task_manager: wait for dependency in threadCb 16/312216/6
authorInki Dae <inki.dae@samsung.com>
Wed, 5 Jun 2024 06:44:17 +0000 (15:44 +0900)
committerInki Dae <inki.dae@samsung.com>
Tue, 11 Jun 2024 09:25:06 +0000 (18:25 +0900)
Wait for dependency in threadCb of each node.
By doing this, it will show more performance than before
because each node is performed in each thread context at the same time.

Change-Id: Ibbd1aafafa110957a0b75a39db78baf6f703b761
Signed-off-by: Inki Dae <inki.dae@samsung.com>
services/task_manager/src/TaskManager.cpp

index e123d06f2c842e7e772a3265c6353c21433c54b5..1adf72f59c70c2fe6fb6826c599bf8b448aa26e0 100644 (file)
@@ -37,6 +37,10 @@ void TaskManager::threadCb(shared_ptr<INode> &node)
 {
        SINGLEO_LOGD("Launched node name = %s", node->getName().c_str());
 
+       // Wait until all nodes added to this node as dependency are completed
+       for (auto &d : node->getDependencies())
+               d->wait();
+
        if (node->getType() == NodeType::INFERENCE) {
                if (_inputs[0]->_data_type != DataType::IMAGE) {
                        SINGLEO_LOGE("Invalid input data type.");
@@ -232,10 +236,6 @@ void TaskManager::run()
                        n->setInputBuffer(inputBuffer);
                }
 
-               // Wait until all nodes added to this node as dependency are completed
-               for (auto &d : n->getDependencies())
-                       d->wait();
-
                threads.push_back(make_unique<thread>(&TaskManager::threadCb, this, std::ref(n)));
        }