Solaris: various repairs

Fix threading, including SIGCHLD mask.
This commit is contained in:
Matthew Flatt 2013-08-09 09:09:51 -06:00
parent 086a1b7525
commit 6bb55f7d14
6 changed files with 26 additions and 11 deletions

View File

@ -895,7 +895,7 @@
__builtin_next_arg __builtin_saveregs
__builtin_constant_p
__builtin___CFStringMakeConstantString
__error __errno_location __toupper __tolower
__error __errno_location __toupper __tolower ___errno
__attribute__ __mode__ ; not really functions in gcc
__iob_func ; VC 8
|GetStdHandle| |__CFStringMakeConstantString|

View File

@ -8814,7 +8814,7 @@ if test "${enable_pthread}" = "yes" ; then
LDFLAGS="$LDFLAGS -pthread"
fi
if test "${use_flag_posix_pthread}" = "yes" ; then
PREFLAGS="$PREFLAGS -D_POSIX_PTHREAD_SEMANTICS"
PREFLAGS="$PREFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT"
fi
cat >>confdefs.h <<\_ACEOF

View File

@ -1215,7 +1215,7 @@ if test "${enable_pthread}" = "yes" ; then
LDFLAGS="$LDFLAGS -pthread"
fi
if test "${use_flag_posix_pthread}" = "yes" ; then
PREFLAGS="$PREFLAGS -D_POSIX_PTHREAD_SEMANTICS"
PREFLAGS="$PREFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT"
fi
AC_DEFINE(USE_PTHREAD_INSTEAD_OF_ITIMER, 1, [Pthread timer enabled])

View File

@ -118,6 +118,10 @@
# define FMOD_CAN_RETURN_POS_ZERO
# ifdef _POSIX_PTHREAD_SEMANTICS
# define SUBPROCESS_USE_FORK1
# endif
# ifdef i386
# define MZ_USE_JIT_I386
# define MZ_JIT_USE_MPROTECT
@ -1236,6 +1240,8 @@
should be closed after performing a fork() for `process'
and `system' calls. */
/* SUBPROCESS_USE_FORK1 uses fork1() instead of fork(). */
/* USE_UNIX_SOCKETS_TCP means that the tcp- procedures can be implemented
with the standard Unix socket functions. */

View File

@ -995,15 +995,18 @@ static void got_sigchld() XFORM_SKIP_PROC
void scheme_places_block_child_signal() XFORM_SKIP_PROC
{
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, NULL);
/* Mac OS X seems to need a handler installed for SIGCHLD to be
delivered, since the default is to drop the signal. Also, this
handler serves as a back-up alert if some thread is created that
does not block SIGCHLD. */
does not block SIGCHLD.
Solaris, meanwhile, seems to unmask SIGCHLD as a result of
setting a handler, so do this before masking the signal. */
MZ_SIGSET(SIGCHLD, got_sigchld);
sigemptyset(&set);
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, NULL);
}
void scheme_places_unblock_child_signal() XFORM_SKIP_PROC

View File

@ -5695,7 +5695,11 @@ static int try_lock(intptr_t fd, int writer, int *_errid)
if (!pipe(ofds)) {
int pid;
#ifdef SUBPROCESS_USE_FORK1
pid = fork1();
#else
pid = fork();
#endif
if (pid > 0) {
/* Original process: */
@ -9814,10 +9818,12 @@ static Scheme_Object *subprocess(int c, Scheme_Object *args[])
scheme_starting_child();
#endif
#if !defined(__QNX__)
pid = fork();
#else
#if defined(__QNX__)
pid = vfork();
#elif defined(SUBPROCESS_USE_FORK1)
pid = fork1();
#else
pid = fork();
#endif
if (pid > 0) {