Skip to content
Permalink
Browse files

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.
  • Loading branch information
icculus committed Nov 14, 2013
1 parent b36d98b commit 7550ddcc05235f924e0ebac1224fcd8c0e601788
@@ -1012,6 +1012,8 @@ elseif(BEOS)
set(HAVE_VIDEO_OPENGL TRUE)
endif(VIDEO_OPENGL)
endif(SDL_VIDEO)

CheckPTHREAD()
endif()

# Dummies
@@ -638,6 +638,9 @@ macro(CheckPTHREAD)
elseif(HPUX)
set(PTHREAD_CFLAGS "-D_REENTRANT")
set(PTHREAD_LDFLAGS "-L/usr/lib -pthread")
elseif(BEOS)
set(PTHREAD_CFLAGS "-D_REENTRANT")
set(PTHREAD_LDFLAGS "")
else()
set(PTHREAD_CFLAGS "-D_REENTRANT")
set(PTHREAD_LDFLAGS "-lpthread")
pthread_cflags="-D_REENTRANT"
pthread_lib="-L/usr/lib -lpthread"
;;
*-*-haiku*)
pthread_cflags="-D_REENTRANT"
pthread_lib=""
;;
*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread"
SDL_LIBS="-lcygwin $SDL_LIBS"
fi
;;
*-*-beos* | *-*-haiku*)


*-*-haiku*)
ARCH=beos
ac_default_prefix=/boot/common
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckBWINDOW
CheckBeGL
CheckPTHREAD
# Set up files for the audio library
if test x$enable_audio = xyes; then

SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
have_joystick=yes
fi
# Set up files for the thread library
if test x$enable_threads = xyes; then

$as_echo "#define SDL_THREAD_BEOS 1" >>confdefs.h

SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
have_threads=yes
fi
# Set up files for the timer library
if test x$enable_timers = xyes; then

@@ -1940,6 +1940,10 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]])
pthread_cflags="-D_REENTRANT"
pthread_lib="-L/usr/lib -lpthread"
;;
*-*-haiku*)
pthread_cflags="-D_REENTRANT"
pthread_lib=""
;;
*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread"
@@ -2613,14 +2617,19 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
SDL_LIBS="-lcygwin $SDL_LIBS"
fi
;;
*-*-beos* | *-*-haiku*)

dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
dnl *-*-beos*)

*-*-haiku*)
ARCH=beos
ac_default_prefix=/boot/common
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckBWINDOW
CheckBeGL
CheckPTHREAD
# Set up files for the audio library
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO, 1, [ ])
@@ -2633,14 +2642,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
have_joystick=yes
fi
# Set up files for the thread library
if test x$enable_threads = xyes; then
AC_DEFINE(SDL_THREAD_BEOS, 1, [ ])
SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
have_threads=yes
fi
# Set up files for the timer library
if test x$enable_timers = xyes; then
AC_DEFINE(SDL_TIMER_BEOS, 1, [ ])
@@ -237,7 +237,6 @@
#cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@

/* Enable various threading systems */
#cmakedefine SDL_THREAD_BEOS @SDL_THREAD_BEOS@
#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
@@ -240,7 +240,6 @@
#undef SDL_LOADSO_WINDOWS

/* Enable various threading systems */
#undef SDL_THREAD_BEOS
#undef SDL_THREAD_PTHREAD
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
@@ -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);
@@ -28,10 +28,6 @@
/* Need the definitions of SYS_ThreadHandle */
#if SDL_THREADS_DISABLED
#include "generic/SDL_systhread_c.h"
#elif SDL_THREAD_BEOS
#include "beos/SDL_systhread_c.h"
#elif SDL_THREAD_EPOC
#include "epoc/SDL_systhread_c.h"
#elif SDL_THREAD_PTHREAD
#include "pthread/SDL_systhread_c.h"
#elif SDL_THREAD_WINDOWS

This file was deleted.

0 comments on commit 7550ddc

Please sign in to comment.