Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
d4ebcf0e
Commit
d4ebcf0e
authored
Oct 09, 2017
by
Simon Spannagel
Browse files
Make user termination work with Ctrl+C
parent
ac3a06ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/core/Analysis.C
View file @
d4ebcf0e
...
...
@@ -16,7 +16,7 @@
using
namespace
corryvreckan
;
// Default constructor
Analysis
::
Analysis
(
std
::
string
config_file_name
)
{
Analysis
::
Analysis
(
std
::
string
config_file_name
)
:
m_terminate
(
false
)
{
// Load the global configuration
conf_mgr_
=
std
::
make_unique
<
corryvreckan
::
ConfigManager
>
(
std
::
move
(
config_file_name
));
...
...
@@ -274,6 +274,11 @@ void Analysis::run() {
// Increment event number
if
(
!
noData
)
m_events
++
;
// Check for user termination and stop the event loop:
if
(
m_terminate
)
{
break
;
}
}
// If running the gui, don't close until the user types a command
...
...
@@ -281,6 +286,10 @@ void Analysis::run() {
cin
.
ignore
();
}
void
Analysis
::
terminate
()
{
m_terminate
=
true
;
}
// Initalise all algorithms
void
Analysis
::
initialiseAll
()
{
int
nTracks
=
0
;
...
...
src/core/Analysis.h
View file @
d4ebcf0e
...
...
@@ -42,6 +42,7 @@ namespace corryvreckan {
void
initialiseAll
();
void
finaliseAll
();
void
terminate
();
void
reset
(){};
TBrowser
*
browser
;
...
...
@@ -58,6 +59,9 @@ namespace corryvreckan {
TDirectory
*
m_directory
;
std
::
map
<
std
::
string
,
void
*>
loaded_libraries_
;
int
m_events
;
private:
std
::
atomic
<
bool
>
m_terminate
;
};
}
#endif // ANALYSIS_H
src/exec/corry.cpp
View file @
d4ebcf0e
...
...
@@ -48,7 +48,7 @@ void interrupt_handler(int) {
// Stop the framework if it is loaded
if
(
cv_ready
)
{
LOG
(
STATUS
)
<<
"Interrupted! Finishing up current event..."
;
corry
->
finaliseAll
();
corry
->
terminate
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment