Skip to content

Commit 04a77c3

Browse files
committed
Start monitor thread when demanded by the attacher device
1 parent ffdb168 commit 04a77c3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

libraries/YarpPlugins/TechnosoftIpos/DeviceDriverImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ bool TechnosoftIposBase::open(yarp::os::Searchable & config)
130130
}
131131
}
132132

133-
return !monitorThread || monitorThread->start();
133+
return true;
134134
}
135135

136136
// -----------------------------------------------------------------------------

libraries/YarpPlugins/TechnosoftIpos/ICanBusSharerImpl.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ bool TechnosoftIposBase::initialize()
124124
yCIWarning(IPOS, id()) << "Initial drive state transitions failed";
125125
}
126126

127+
// the monitor thread itself may call `initialize()`, so we need to check to avoid starting twice
128+
if (monitorThread && !monitorThread->isRunning() && !monitorThread->start())
129+
{
130+
yCIError(IPOS, id()) << "Unable to start monitor thread";
131+
return false;
132+
}
133+
127134
return true;
128135
}
129136

0 commit comments

Comments
 (0)