mirror of
https://github.com/python/cpython.git
synced 2025-09-22 08:23:36 +00:00
Make better use of GNU Pth -- patch by Andy Dustman.
I can't test this, so I'm just checking it in with blind faith in Andy. I've tested that it doesn't broeak a non-Pth build on Linux. Changes include: - There's a --with-pth configure option. - Instead of _GNU_PTH, we test for HAVE_PTH. - Better signal handling. - (The config.h.in file is regenerated in a slightly different order.)
This commit is contained in:
parent
0344424793
commit
9e8181b809
7 changed files with 521 additions and 558 deletions
|
@ -111,7 +111,7 @@
|
||||||
#define Py_file_input 257
|
#define Py_file_input 257
|
||||||
#define Py_eval_input 258
|
#define Py_eval_input 258
|
||||||
|
|
||||||
#ifdef _GNU_PTH
|
#ifdef HAVE_PTH
|
||||||
/* GNU pth user-space thread support */
|
/* GNU pth user-space thread support */
|
||||||
#include <pth.h>
|
#include <pth.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,6 +62,9 @@
|
||||||
handler ignores signals if getpid() isn't the same as in the main
|
handler ignores signals if getpid() isn't the same as in the main
|
||||||
thread. XXX This is a hack.
|
thread. XXX This is a hack.
|
||||||
|
|
||||||
|
GNU pth is a user-space threading library, and as such, all threads
|
||||||
|
run within the same process. In this case, if the currently running
|
||||||
|
thread is not the main_thread, send the signal to the main_thread.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WITH_THREAD
|
#ifdef WITH_THREAD
|
||||||
|
@ -109,6 +112,12 @@ static void
|
||||||
signal_handler(int sig_num)
|
signal_handler(int sig_num)
|
||||||
{
|
{
|
||||||
#ifdef WITH_THREAD
|
#ifdef WITH_THREAD
|
||||||
|
#ifdef WITH_PTH
|
||||||
|
if (PyThread_get_thread_ident() != main_thread) {
|
||||||
|
pth_raise(*(pth_t *) main_thread, sig_num);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* See NOTES section above */
|
/* See NOTES section above */
|
||||||
if (getpid() == main_pid) {
|
if (getpid() == main_pid) {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -109,13 +109,14 @@ void PyThread_init_thread(void)
|
||||||
#include "thread_lwp.h"
|
#include "thread_lwp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _GNU_PTH
|
#ifdef HAVE_PTH
|
||||||
#include "thread_pth.h"
|
#include "thread_pth.h"
|
||||||
#else
|
#undef _POSIX_THREADS
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _POSIX_THREADS
|
#ifdef _POSIX_THREADS
|
||||||
#include "thread_pthread.h"
|
#include "thread_pthread.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef C_THREADS
|
#ifdef C_THREADS
|
||||||
#include "thread_cthread.h"
|
#include "thread_cthread.h"
|
||||||
|
|
|
@ -35,9 +35,6 @@
|
||||||
This is the case on Motorola V4 (R40V4.2) */
|
This is the case on Motorola V4 (R40V4.2) */
|
||||||
#undef GETTIMEOFDAY_NO_TZ
|
#undef GETTIMEOFDAY_NO_TZ
|
||||||
|
|
||||||
/* Define if you have GNU PTH threads */
|
|
||||||
#undef _GNU_PTH
|
|
||||||
|
|
||||||
/* Define this if your time.h defines altzone */
|
/* Define this if your time.h defines altzone */
|
||||||
#undef HAVE_ALTZONE
|
#undef HAVE_ALTZONE
|
||||||
|
|
||||||
|
@ -65,6 +62,9 @@
|
||||||
/* Define if your compiler supports function prototypes */
|
/* Define if your compiler supports function prototypes */
|
||||||
#undef HAVE_PROTOTYPES
|
#undef HAVE_PROTOTYPES
|
||||||
|
|
||||||
|
/* Define if you have GNU PTH threads */
|
||||||
|
#undef HAVE_PTH
|
||||||
|
|
||||||
/* Define if your compiler supports variable length function prototypes
|
/* Define if your compiler supports variable length function prototypes
|
||||||
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
|
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
|
||||||
#undef HAVE_STDARG_PROTOTYPES
|
#undef HAVE_STDARG_PROTOTYPES
|
||||||
|
|
20
config.h.in
20
config.h.in
|
@ -103,9 +103,6 @@
|
||||||
This is the case on Motorola V4 (R40V4.2) */
|
This is the case on Motorola V4 (R40V4.2) */
|
||||||
#undef GETTIMEOFDAY_NO_TZ
|
#undef GETTIMEOFDAY_NO_TZ
|
||||||
|
|
||||||
/* Define if you have GNU PTH threads */
|
|
||||||
#undef _GNU_PTH
|
|
||||||
|
|
||||||
/* Define this if your time.h defines altzone */
|
/* Define this if your time.h defines altzone */
|
||||||
#undef HAVE_ALTZONE
|
#undef HAVE_ALTZONE
|
||||||
|
|
||||||
|
@ -130,6 +127,9 @@
|
||||||
/* Define if your compiler supports function prototypes */
|
/* Define if your compiler supports function prototypes */
|
||||||
#undef HAVE_PROTOTYPES
|
#undef HAVE_PROTOTYPES
|
||||||
|
|
||||||
|
/* Define if you have GNU PTH threads */
|
||||||
|
#undef HAVE_PTH
|
||||||
|
|
||||||
/* Define if your compiler supports variable length function prototypes
|
/* Define if your compiler supports variable length function prototypes
|
||||||
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
|
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
|
||||||
#undef HAVE_STDARG_PROTOTYPES
|
#undef HAVE_STDARG_PROTOTYPES
|
||||||
|
@ -272,6 +272,9 @@
|
||||||
/* The number of bytes in a void *. */
|
/* The number of bytes in a void *. */
|
||||||
#undef SIZEOF_VOID_P
|
#undef SIZEOF_VOID_P
|
||||||
|
|
||||||
|
/* Define if you have the _getpty function. */
|
||||||
|
#undef HAVE__GETPTY
|
||||||
|
|
||||||
/* Define if you have the alarm function. */
|
/* Define if you have the alarm function. */
|
||||||
#undef HAVE_ALARM
|
#undef HAVE_ALARM
|
||||||
|
|
||||||
|
@ -359,9 +362,6 @@
|
||||||
/* Define if you have the getpid function. */
|
/* Define if you have the getpid function. */
|
||||||
#undef HAVE_GETPID
|
#undef HAVE_GETPID
|
||||||
|
|
||||||
/* Define if you have the _getpty function. */
|
|
||||||
#undef HAVE__GETPTY
|
|
||||||
|
|
||||||
/* Define if you have the getpwent function. */
|
/* Define if you have the getpwent function. */
|
||||||
#undef HAVE_GETPWENT
|
#undef HAVE_GETPWENT
|
||||||
|
|
||||||
|
@ -521,14 +521,14 @@
|
||||||
/* Define if you have the waitpid function. */
|
/* Define if you have the waitpid function. */
|
||||||
#undef HAVE_WAITPID
|
#undef HAVE_WAITPID
|
||||||
|
|
||||||
/* Define if you have the <db_185.h> header file. */
|
/* Define if you have the <db.h> header file. */
|
||||||
#undef HAVE_DB_185_H
|
#undef HAVE_DB_H
|
||||||
|
|
||||||
/* Define if you have the <db1/ndbm.h> header file. */
|
/* Define if you have the <db1/ndbm.h> header file. */
|
||||||
#undef HAVE_DB1_NDBM_H
|
#undef HAVE_DB1_NDBM_H
|
||||||
|
|
||||||
/* Define if you have the <db.h> header file. */
|
/* Define if you have the <db_185.h> header file. */
|
||||||
#undef HAVE_DB_H
|
#undef HAVE_DB_185_H
|
||||||
|
|
||||||
/* Define if you have the <dirent.h> header file. */
|
/* Define if you have the <dirent.h> header file. */
|
||||||
#undef HAVE_DIRENT_H
|
#undef HAVE_DIRENT_H
|
||||||
|
|
13
configure.in
13
configure.in
|
@ -745,6 +745,15 @@ else
|
||||||
AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(C_THREADS)
|
AC_DEFINE(C_THREADS)
|
||||||
LIBOBJS="$LIBOBJS thread.o"],[
|
LIBOBJS="$LIBOBJS thread.o"],[
|
||||||
|
AC_MSG_CHECKING(for --with-pth)
|
||||||
|
AC_ARG_WITH(pth,
|
||||||
|
[ --with-pth use GNU pth threading libraries], [
|
||||||
|
AC_MSG_RESULT($withval)
|
||||||
|
AC_DEFINE(WITH_THREAD)
|
||||||
|
AC_DEFINE(HAVE_PTH)
|
||||||
|
LIBS="-lpth $LIBS"
|
||||||
|
LIBOBJS="$LIBOBJS thread.o"],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
AC_DEFINE(_POSIX_THREADS)
|
||||||
LIBS="-lpthread $LIBS"
|
LIBS="-lpthread $LIBS"
|
||||||
|
@ -767,10 +776,6 @@ else
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
AC_DEFINE(_POSIX_THREADS)
|
||||||
LIBS="$LIBS -lthread"
|
LIBS="$LIBS -lthread"
|
||||||
LIBOBJS="$LIBOBJS thread.o"], [
|
LIBOBJS="$LIBOBJS thread.o"], [
|
||||||
AC_CHECK_LIB(pth, pth_init, [AC_DEFINE(WITH_THREAD)
|
|
||||||
AC_DEFINE(_GNU_PTH)
|
|
||||||
LIBS="-lpth $LIBS"
|
|
||||||
LIBOBJS="$LIBOBJS thread.o"],[
|
|
||||||
AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
AC_DEFINE(_POSIX_THREADS)
|
||||||
LIBS="$LIBS -lcma"
|
LIBS="$LIBS -lcma"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue