diff options
author | Stefan Pöschel <github@basicmaster.de> | 2017-04-30 15:24:09 +0200 |
---|---|---|
committer | Stefan Pöschel <github@basicmaster.de> | 2017-04-30 15:24:09 +0200 |
commit | f560123f3e9254d90091b2aa4e839268ec1936a9 (patch) | |
tree | c446f13634b2ddc1cecf600f4c2c29d33f3576c3 | |
parent | d0f13d44c93862948664eae14584c5e31f8ba745 (diff) | |
download | ODR-PadEnc-f560123f3e9254d90091b2aa4e839268ec1936a9.tar.gz ODR-PadEnc-f560123f3e9254d90091b2aa4e839268ec1936a9.tar.bz2 ODR-PadEnc-f560123f3e9254d90091b2aa4e839268ec1936a9.zip |
Move break handler modification
Move them right before the loop, as before a break (e.g. while waiting
for the audio decoder opening the pipe) didn't lead to termination.
-rw-r--r-- | src/odr-padenc.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp index 2fd3a47..8a873fa 100644 --- a/src/odr-padenc.cpp +++ b/src/odr-padenc.cpp @@ -159,20 +159,6 @@ static bool read_slides_dir(const std::string& dir, History& history, std::list< int main(int argc, char *argv[]) { - // handle signals - if(signal(SIGINT, break_handler) == SIG_ERR) { - perror("ODR-PadEnc Error: could not set SIGINT handler"); - return 1; - } - if(signal(SIGTERM, break_handler) == SIG_ERR) { - perror("ODR-PadEnc Error: could not set SIGTERM handler"); - return 1; - } - if(signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - perror("ODR-PadEnc Error: could not set SIGPIPE to be ignored"); - return 1; - } - size_t padlen = 58; bool erase_after_tx = false; int sleepdelay = SLEEPDELAY_DEFAULT; @@ -331,6 +317,20 @@ int main(int argc, char *argv[]) { std::chrono::steady_clock::time_point next_run = std::chrono::steady_clock::now(); + // handle signals + if(signal(SIGINT, break_handler) == SIG_ERR) { + perror("ODR-PadEnc Error: could not set SIGINT handler"); + return 1; + } + if(signal(SIGTERM, break_handler) == SIG_ERR) { + perror("ODR-PadEnc Error: could not set SIGTERM handler"); + return 1; + } + if(signal(SIGPIPE, SIG_IGN) == SIG_ERR) { + perror("ODR-PadEnc Error: could not set SIGPIPE to be ignored"); + return 1; + } + while(!do_exit) { // try to read slides dir (if present) if (sls_dir && slides_to_transmit.empty()) { |