Started BeOS removal: merged BeOS thread and pthread code.

Haiku uses most of the standard pthread API, with a few #ifdefs where we
still need to fallback onto the old BeOS APIs.

BeOS, however, does not support pthreads (or maybe doesn't support it well),
so I'm unplugging support for the platform with this changeset. Be Inc went
out of business in 2001.

--HG--
extra : rebase_source : c7227f47193228c898cc997ebcf9bb00ead329e6
This commit is contained in:
Ryan C. Gordon 2013-11-13 22:35:26 -05:00
parent cb3d7d3831
commit bcaa9c4c22
13 changed files with 61 additions and 408 deletions

View file

@ -25,6 +25,7 @@
/* Allow access to the audio stream on BeOS */
#include <SoundPlayer.h>
#include <signal.h>
#include "../../main/beos/SDL_BeApp.h"
@ -85,6 +86,31 @@ BEOSAUDIO_CloseDevice(_THIS)
}
}
static const int sig_list[] = {
SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGWINCH, 0
};
static inline void
MaskSignals(sigset_t * omask)
{
sigset_t mask;
int i;
sigemptyset(&mask);
for (i = 0; sig_list[i]; ++i) {
sigaddset(&mask, sig_list[i]);
}
sigprocmask(SIG_BLOCK, &mask, omask);
}
static inline void
UnmaskSignals(sigset_t * omask)
{
sigprocmask(SIG_SETMASK, omask, NULL);
}
static int
BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
{
@ -162,10 +188,10 @@ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
/* Subscribe to the audio stream (creates a new thread) */
sigset_t omask;
SDL_MaskSignals(&omask);
MaskSignals(&omask);
_this->hidden->audio_obj = new BSoundPlayer(&format, "SDL Audio",
FillSound, NULL, _this);
SDL_UnmaskSignals(&omask);
UnmaskSignals(&omask);
if (_this->hidden->audio_obj->Start() == B_NO_ERROR) {
_this->hidden->audio_obj->SetHasData(true);