Skip to content
Snippets Groups Projects
Commit 48f82c69 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

Merge branch 'master' of https://gitlab.com/ArmarX/RobotAPI

* 'master' of https://gitlab.com/ArmarX/RobotAPI:
  made NJointController cleanup exception safe
parents aeb77e29 d684b359
No related branches found
No related tags found
No related merge requests found
......@@ -295,17 +295,22 @@ namespace armarx
NJointController::~NJointController()
{
// make sure the destructor of the handles does not throw an exception and triggers a termination of the process
try
ARMARX_DEBUG << "Deleting thread handles";
ScopedLock lock(threadHandlesMutex);
for (auto& pair : threadHandles)
{
ARMARX_DEBUG << "Deleting thread handles";
ScopedLock lock(threadHandlesMutex);
for (auto& pair : threadHandles)
try
{
auto& name = pair.first;
auto& handle = pair.second;
if (!handle)
if (!handle || !handle->isValid())
{
ARMARX_VERBOSE << "Thread Handle is NULL or invalid - skipping";
continue;
}
if (handle->isDetached())
{
ARMARX_VERBOSE << "Thread Handle is NULL - skipping";
continue;
}
std::future_status status;
......@@ -325,14 +330,15 @@ namespace armarx
}
while (status != std::future_status::ready);
}
catch (...)
{
handleExceptions();
}
}
threadHandles.clear();
threadHandles.clear();
}
catch (...)
{
handleExceptions();
}
}
ControlTargetBase* NJointController::useControlTarget(const std::string& deviceName, const std::string& controlMode)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment