src/audio/baudio/SDL_beaudio.cc
changeset 7977 5272ae8fccd7
parent 7038 7f22b9ba218f
child 7979 93d31af030bc
     1.1 --- a/src/audio/baudio/SDL_beaudio.cc	Wed Nov 13 21:50:59 2013 -0800
     1.2 +++ b/src/audio/baudio/SDL_beaudio.cc	Wed Nov 13 22:35:26 2013 -0500
     1.3 @@ -25,6 +25,7 @@
     1.4  /* Allow access to the audio stream on BeOS */
     1.5  
     1.6  #include <SoundPlayer.h>
     1.7 +#include <signal.h>
     1.8  
     1.9  #include "../../main/beos/SDL_BeApp.h"
    1.10  
    1.11 @@ -85,6 +86,31 @@
    1.12      }
    1.13  }
    1.14  
    1.15 +
    1.16 +static const int sig_list[] = {
    1.17 +    SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGWINCH, 0
    1.18 +};
    1.19 +
    1.20 +static inline void
    1.21 +MaskSignals(sigset_t * omask)
    1.22 +{
    1.23 +    sigset_t mask;
    1.24 +    int i;
    1.25 +
    1.26 +    sigemptyset(&mask);
    1.27 +    for (i = 0; sig_list[i]; ++i) {
    1.28 +        sigaddset(&mask, sig_list[i]);
    1.29 +    }
    1.30 +    sigprocmask(SIG_BLOCK, &mask, omask);
    1.31 +}
    1.32 +
    1.33 +static inline void
    1.34 +UnmaskSignals(sigset_t * omask)
    1.35 +{
    1.36 +    sigprocmask(SIG_SETMASK, omask, NULL);
    1.37 +}
    1.38 +
    1.39 +
    1.40  static int
    1.41  BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
    1.42  {
    1.43 @@ -162,10 +188,10 @@
    1.44  
    1.45      /* Subscribe to the audio stream (creates a new thread) */
    1.46      sigset_t omask;
    1.47 -    SDL_MaskSignals(&omask);
    1.48 +    MaskSignals(&omask);
    1.49      _this->hidden->audio_obj = new BSoundPlayer(&format, "SDL Audio",
    1.50                                                  FillSound, NULL, _this);
    1.51 -    SDL_UnmaskSignals(&omask);
    1.52 +    UnmaskSignals(&omask);
    1.53  
    1.54      if (_this->hidden->audio_obj->Start() == B_NO_ERROR) {
    1.55          _this->hidden->audio_obj->SetHasData(true);