]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #805613: Fix usage of the PTH library.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 20 Sep 2003 11:13:18 +0000 (11:13 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 20 Sep 2003 11:13:18 +0000 (11:13 +0000)
Misc/NEWS
Python/thread.c
Python/thread_pth.h

index 28750d5484c368368c989862994baf6414bd7082..7e3ce171253055b1e3f143173582ead05c73a316 100644 (file)
--- 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
index 87230e02e0ae9be09d1656d416cce1fac2e6bd36..2298b383e79e69c48701bda2fdae7de5ec8e3eb0 100644 (file)
@@ -98,6 +98,7 @@ void PyThread_init_thread(void)
 
 #ifdef HAVE_PTH
 #include "thread_pth.h"
+#undef _POSIX_THREADS
 #endif
 
 #ifdef _POSIX_THREADS
index 3b97981ff9ebcd07aa0df1f693a244daf66e25b0..8c7dbe925702ba94cb32aba987e8ad565d378b18 100644 (file)
@@ -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
                                 );