Skip to content

Commit bf9dbbf

Browse files
author
Souvik Roy
committed
Remove redundant async call in FRU collection threads (#588)
This commit removes the redundant std:async call in the detached thread launched for parsing and publishing the VPD for an individual FRU. Since we have a dedicated detached thread for each FRU, we can do VPD parse and publish in a synchronous manner from the detached thread itself, instead of launching a asynchronous task which adds unnecessary performance cost. This commit addresses issue #558. Test: ``` 1. Install bitbaked image on Everest (ever6bmc) 2. After initial boot, check: - BMC State Ready - vpd-manager's CollectionStatus property should be "Completed" busctl get-property com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager CollectionStatus s "Completed" - vpd-manager status should be running with no restarts - vpd-manager should have only 1 thread running: check "ls -la /proc/<vpd-manager PID>/task" 3. Reboot the BMC several times and repeat Step 2. ``` Change-Id: I603c64dc9b5057429a2288f0edfde6086755b851 Signed-off-by: Souvik Roy <[email protected]>
1 parent 8d35fae commit bf9dbbf

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

vpd-manager/include/worker.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class Worker
8080
* Note: Config JSON file path should be passed to worker class constructor
8181
* to make use of this API.
8282
*
83+
* @throw std::runtime_error, std::system_error
8384
*/
8485
void collectFrusFromJson();
8586

vpd-manager/src/worker.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,12 +1513,8 @@ void Worker::collectFrusFromJson()
15131513
}
15141514

15151515
std::thread{[vpdFilePath, this]() {
1516-
auto l_futureObject = std::async(&Worker::parseAndPublishVPD, this,
1517-
vpdFilePath);
1516+
const auto& l_parseResult = parseAndPublishVPD(vpdFilePath);
15181517

1519-
std::tuple<bool, std::string> l_threadInfo = l_futureObject.get();
1520-
1521-
// thread returned.
15221518
m_mutex.lock();
15231519
m_activeCollectionThreadCount--;
15241520
m_mutex.unlock();

0 commit comments

Comments
 (0)