summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-09-20 11:13:18 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-09-20 11:13:18 (GMT)
commit6280f00d495bd6042c8f60aa10042d0c0ffae470 (patch)
treeee107f45719769cf1d0060b23107a0e04a14aaca
parent2857ef50badd4c49df5a3ecb05027703f697d176 (diff)
downloadcpython-6280f00d495bd6042c8f60aa10042d0c0ffae470.zip
cpython-6280f00d495bd6042c8f60aa10042d0c0ffae470.tar.gz
cpython-6280f00d495bd6042c8f60aa10042d0c0ffae470.tar.bz2
Patch #805613: Fix usage of the PTH library.
-rw-r--r--Misc/NEWS2
-rw-r--r--Python/thread.c1
-rw-r--r--Python/thread_pth.h7
3 files changed, 9 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 28750d5..7e3ce17 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.3.1?
Core and builtins
-----------------
+- Patch #805613: Fix usage of the PTH library.
+
- Fixed a bug in the cache of length-one Unicode strings that could
lead to a seg fault. The specific problem occurred when an earlier,
non-fatal error left an uninitialized Unicode object in the
diff --git a/Python/thread.c b/Python/thread.c
index 87230e0..2298b38 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -98,6 +98,7 @@ void PyThread_init_thread(void)
#ifdef HAVE_PTH
#include "thread_pth.h"
+#undef _POSIX_THREADS
#endif
#ifdef _POSIX_THREADS
diff --git a/Python/thread_pth.h b/Python/thread_pth.h
index 3b97981..8c7dbe9 100644
--- a/Python/thread_pth.h
+++ b/Python/thread_pth.h
@@ -30,6 +30,8 @@ typedef struct {
#define CHECK_STATUS(name) if (status == -1) { printf("%d ", status); perror(name); error = 1; }
+pth_attr_t PyThread_attr;
+
/*
* Initialization.
*/
@@ -37,6 +39,9 @@ typedef struct {
static void PyThread__init_thread(void)
{
pth_init();
+ PyThread_attr = pth_attr_new();
+ pth_attr_set(PyThread_attr, PTH_ATTR_STACK_SIZE, 1<<18);
+ pth_attr_set(PyThread_attr, PTH_ATTR_JOINABLE, FALSE);
}
/*
@@ -51,7 +56,7 @@ long PyThread_start_new_thread(void (*func)(void *), void *arg)
if (!initialized)
PyThread_init_thread();
- th = pth_spawn(PTH_ATTR_DEFAULT,
+ th = pth_spawn(PyThread_attr,
(void* (*)(void *))func,
(void *)arg
);