Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
eeb0e063
Commit
eeb0e063
authored
1 month ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Fix error/signal handling raised in a multi-threaded context
parent
6b4eb157
No related branches found
No related tags found
1 merge request
!205
High-order polynomial reconstruction
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/SignalManager.cpp
+55
-49
55 additions, 49 deletions
src/utils/SignalManager.cpp
with
55 additions
and
49 deletions
src/utils/SignalManager.cpp
+
55
−
49
View file @
eeb0e063
...
...
@@ -52,17 +52,27 @@ SignalManager::signalName(int signal)
void
SignalManager
::
pauseForDebug
(
int
signal
)
{
if
(
std
::
string
(
PUGS_BUILD_TYPE
)
!=
"Release"
)
{
if
(
s_pause_on_error
)
{
// Each failing process must write
std
::
cerr
.
clear
();
if
(
std
::
string
(
PUGS_BUILD_TYPE
)
!=
"Release"
)
{
char
hostname
[
HOST_NAME_MAX
+
1
];
gethostname
(
hostname
,
HOST_NAME_MAX
+
1
);
std
::
cerr
<<
"
\n
======================================
\n
"
<<
rang
::
style
::
reset
<<
rang
::
fg
::
reset
<<
rang
::
style
::
bold
<<
"to attach gdb to this process run
\n
"
<<
rang
::
style
::
reset
<<
rang
::
fg
::
reset
<<
rang
::
style
::
bold
<<
"Process paused on host
\"
"
<<
rang
::
fg
::
yellow
<<
hostname
<<
rang
::
fg
::
reset
<<
"
\"\n
"
<<
"to attach gdb to this process run
\n
"
<<
"
\t
gdb -pid "
<<
rang
::
fg
::
red
<<
getpid
()
<<
rang
::
fg
::
reset
<<
'\n'
<<
"else press Control-C to exit
\n
"
<<
rang
::
style
::
reset
<<
"======================================
\n
"
<<
std
::
flush
;
pause
();
}
else
{
std
::
cerr
<<
'\n'
<<
rang
::
style
::
bold
<<
"Pausing is useless for Release version.
\n
"
"To attach debugger use Debug built type."
<<
rang
::
style
::
reset
<<
'\n'
;
}
}
std
::
exit
(
signal
);
...
...
@@ -73,10 +83,9 @@ SignalManager::handler(int signal)
{
static
std
::
mutex
mutex
;
if
(
mutex
.
try_lock
())
{
std
::
signal
(
SIGTERM
,
SIG_DFL
);
std
::
signal
(
SIGINT
,
SIG_DFL
);
std
::
signal
(
SIGABRT
,
SIG_DFL
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex
);
std
::
signal
(
SIGINT
,
SIG_BLOCK
);
// Each failing process must write
std
::
cerr
.
clear
();
...
...
@@ -120,9 +129,6 @@ SignalManager::handler(int signal)
}
SignalManager
::
pauseForDebug
(
signal
);
mutex
.
unlock
();
}
}
void
...
...
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