new setSigHandlersForDecoder() function, and be sure player/decode processes ignore SIGHUP signals
git-svn-id: https://svn.musicpd.org/mpd/trunk@2492 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "signal_check.h"
|
||||
#include "log.h"
|
||||
#include "player.h"
|
||||
#include "decode.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
@@ -89,6 +90,21 @@ void finishSigHandlers() {
|
||||
signal_unhandle(SIGHUP);
|
||||
}
|
||||
|
||||
void setSigHandlersForDecoder() {
|
||||
struct sigaction sa;
|
||||
|
||||
finishSigHandlers();
|
||||
|
||||
sa.sa_flags = 0;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_handler = SIG_IGN;
|
||||
while(sigaction(SIGHUP,&sa,NULL)<0 && errno==EINTR);
|
||||
sa.sa_handler = decodeSigHandler;
|
||||
while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
|
||||
while(sigaction(SIGTERM,&sa,NULL)<0 && errno==EINTR);
|
||||
while(sigaction(SIGINT,&sa,NULL)<0 && errno==EINTR);
|
||||
}
|
||||
|
||||
void ignoreSignals() {
|
||||
struct sigaction sa;
|
||||
|
||||
|
Reference in New Issue
Block a user