Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
c005dd83
Commit
c005dd83
authored
2 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
fix shutdown issues when waiting for devices (cf. #10029)
parent
8a5a47c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/DeviceManager.h
+2
-0
2 additions, 0 deletions
include/DeviceManager.h
src/Application.cc
+6
-0
6 additions, 0 deletions
src/Application.cc
src/DeviceManager.cc
+22
-0
22 additions, 0 deletions
src/DeviceManager.cc
with
30 additions
and
0 deletions
include/DeviceManager.h
+
2
−
0
View file @
c005dd83
...
...
@@ -130,6 +130,8 @@ namespace ChimeraTK {
*/
[[
nodiscard
]]
Device
&
getDevice
()
{
return
_device
;
}
void
terminate
()
override
;
protected
:
/**
* Use this function to read the exception version number. It is locking the variable mutex correctly for you.
...
...
This diff is collapsed.
Click to expand it.
src/Application.cc
+
6
−
0
View file @
c005dd83
...
...
@@ -185,6 +185,12 @@ void Application::shutdown() {
internalModule
->
deactivate
();
}
// shutdown all DeviceManagers, otherwise application modules might hang if still waiting for initial values from
// devices
for
(
auto
&
pair
:
_deviceManagerMap
)
{
pair
.
second
->
terminate
();
}
// next deactivate the modules, as they have running threads inside as well
for
(
auto
&
module
:
getSubmoduleListRecursive
())
{
module
->
terminate
();
...
...
This diff is collapsed.
Click to expand it.
src/DeviceManager.cc
+
22
−
0
View file @
c005dd83
...
...
@@ -398,4 +398,26 @@ namespace ChimeraTK {
/*********************************************************************************************************************/
void
DeviceManager
::
terminate
()
{
if
(
moduleThread
.
joinable
())
{
moduleThread
.
interrupt
();
// try joining the thread
while
(
!
moduleThread
.
try_join_for
(
boost
::
chrono
::
milliseconds
(
10
)))
{
// send boost interrupted exception through the _errorQueue
try
{
throw
boost
::
thread_interrupted
();
}
catch
(
boost
::
thread_interrupted
&
)
{
_errorQueue
.
push_exception
(
std
::
current_exception
());
}
// it may not suffice to send the exception once, as the exception might get overwritten in the queue, thus we
// repeat this until the thread was joined.
}
}
assert
(
!
moduleThread
.
joinable
());
}
/*********************************************************************************************************************/
}
// namespace ChimeraTK
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment