Skip to content

Commit b9b8c4c

Browse files
author
gvanrossum
committed
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.) git-svn-id: http://svn.python.org/projects/python/trunk@17529 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent cda1946 commit b9b8c4c

7 files changed

Lines changed: 521 additions & 558 deletions

File tree

Include/Python.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
#define Py_file_input 257
112112
#define Py_eval_input 258
113113

114-
#ifdef _GNU_PTH
114+
#ifdef HAVE_PTH
115115
/* GNU pth user-space thread support */
116116
#include <pth.h>
117117
#endif

Modules/signalmodule.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
handler ignores signals if getpid() isn't the same as in the main
6363
thread. XXX This is a hack.
6464
65+
GNU pth is a user-space threading library, and as such, all threads
66+
run within the same process. In this case, if the currently running
67+
thread is not the main_thread, send the signal to the main_thread.
6568
*/
6669

6770
#ifdef WITH_THREAD
@@ -109,6 +112,12 @@ static void
109112
signal_handler(int sig_num)
110113
{
111114
#ifdef WITH_THREAD
115+
#ifdef WITH_PTH
116+
if (PyThread_get_thread_ident() != main_thread) {
117+
pth_raise(*(pth_t *) main_thread, sig_num);
118+
return;
119+
}
120+
#endif
112121
/* See NOTES section above */
113122
if (getpid() == main_pid) {
114123
#endif

Python/thread.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,14 @@ void PyThread_init_thread(void)
109109
#include "thread_lwp.h"
110110
#endif
111111

112-
#ifdef _GNU_PTH
112+
#ifdef HAVE_PTH
113113
#include "thread_pth.h"
114-
#else
114+
#undef _POSIX_THREADS
115+
#endif
116+
115117
#ifdef _POSIX_THREADS
116118
#include "thread_pthread.h"
117119
#endif
118-
#endif
119120

120121
#ifdef C_THREADS
121122
#include "thread_cthread.h"

acconfig.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
This is the case on Motorola V4 (R40V4.2) */
3636
#undef GETTIMEOFDAY_NO_TZ
3737

38-
/* Define if you have GNU PTH threads */
39-
#undef _GNU_PTH
40-
4138
/* Define this if your time.h defines altzone */
4239
#undef HAVE_ALTZONE
4340

@@ -65,6 +62,9 @@
6562
/* Define if your compiler supports function prototypes */
6663
#undef HAVE_PROTOTYPES
6764

65+
/* Define if you have GNU PTH threads */
66+
#undef HAVE_PTH
67+
6868
/* Define if your compiler supports variable length function prototypes
6969
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
7070
#undef HAVE_STDARG_PROTOTYPES

config.h.in

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@
103103
This is the case on Motorola V4 (R40V4.2) */
104104
#undef GETTIMEOFDAY_NO_TZ
105105

106-
/* Define if you have GNU PTH threads */
107-
#undef _GNU_PTH
108-
109106
/* Define this if your time.h defines altzone */
110107
#undef HAVE_ALTZONE
111108

@@ -130,6 +127,9 @@
130127
/* Define if your compiler supports function prototypes */
131128
#undef HAVE_PROTOTYPES
132129

130+
/* Define if you have GNU PTH threads */
131+
#undef HAVE_PTH
132+
133133
/* Define if your compiler supports variable length function prototypes
134134
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
135135
#undef HAVE_STDARG_PROTOTYPES
@@ -272,6 +272,9 @@
272272
/* The number of bytes in a void *. */
273273
#undef SIZEOF_VOID_P
274274

275+
/* Define if you have the _getpty function. */
276+
#undef HAVE__GETPTY
277+
275278
/* Define if you have the alarm function. */
276279
#undef HAVE_ALARM
277280

@@ -359,9 +362,6 @@
359362
/* Define if you have the getpid function. */
360363
#undef HAVE_GETPID
361364

362-
/* Define if you have the _getpty function. */
363-
#undef HAVE__GETPTY
364-
365365
/* Define if you have the getpwent function. */
366366
#undef HAVE_GETPWENT
367367

@@ -521,14 +521,14 @@
521521
/* Define if you have the waitpid function. */
522522
#undef HAVE_WAITPID
523523

524-
/* Define if you have the <db_185.h> header file. */
525-
#undef HAVE_DB_185_H
524+
/* Define if you have the <db.h> header file. */
525+
#undef HAVE_DB_H
526526

527527
/* Define if you have the <db1/ndbm.h> header file. */
528528
#undef HAVE_DB1_NDBM_H
529529

530-
/* Define if you have the <db.h> header file. */
531-
#undef HAVE_DB_H
530+
/* Define if you have the <db_185.h> header file. */
531+
#undef HAVE_DB_185_H
532532

533533
/* Define if you have the <dirent.h> header file. */
534534
#undef HAVE_DIRENT_H

0 commit comments

Comments
 (0)