SApiMgr:attDevReq: use body||world thread for i/e-devs

We now pass in the correct ComponentThread based on the type of
device that's being attached.
This commit is contained in:
2025-09-15 12:47:37 -04:00
parent 472184bbbc
commit db8f047322
4 changed files with 35 additions and 10 deletions
+24 -1
View File
@@ -283,7 +283,30 @@ void SenseApiManager::attachSenseDeviceReq(
std::string(__func__) + ": attachDeviceReq() is NULL for library '"
+ lib.libraryPath + "'");
}
lib.senseApiDesc.sal_mgmt_libOps.attachDeviceReq(spec, cb);
/** EXPLANATION:
* We pass in either the body or world thread here, depending on whether
* the device is an introspector (idev) or extrospector (edev).
*
* Introspectors are attached to the body thread; extrospectors are attached
* to the world thread.
*/
std::shared_ptr<ComponentThread> threadForAttachment;
if (spec->sensorType == 'e')
{
threadForAttachment = mind::globalMind->world.thread;
std::cout << __func__ << ": Attaching edev " << spec->deviceIdentifier
<< " to world thread" << "\n";
}
else
{
threadForAttachment = mind::globalMind->body.thread;
std::cout << __func__ << ": Attaching non-edev "
<< spec->deviceIdentifier << " to body thread" << "\n";
}
lib.senseApiDesc.sal_mgmt_libOps.attachDeviceReq(
spec, threadForAttachment, cb);
}
void SenseApiManager::detachSenseDeviceReq(