Skip to content

Commit a1b7e47

Browse files
author
loewis
committed
Patch #805613: Fix usage of the PTH library.
git-svn-id: http://svn.python.org/projects/python/trunk@34178 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent ae9a7ef commit a1b7e47

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Python/thread.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void PyThread_init_thread(void)
9898

9999
#ifdef HAVE_PTH
100100
#include "thread_pth.h"
101+
#undef _POSIX_THREADS
101102
#endif
102103

103104
#ifdef _POSIX_THREADS

Python/thread_pth.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ typedef struct {
3030

3131
#define CHECK_STATUS(name) if (status == -1) { printf("%d ", status); perror(name); error = 1; }
3232

33+
pth_attr_t PyThread_attr;
34+
3335
/*
3436
* Initialization.
3537
*/
3638

3739
static void PyThread__init_thread(void)
3840
{
3941
pth_init();
42+
PyThread_attr = pth_attr_new();
43+
pth_attr_set(PyThread_attr, PTH_ATTR_STACK_SIZE, 1<<18);
44+
pth_attr_set(PyThread_attr, PTH_ATTR_JOINABLE, FALSE);
4045
}
4146

4247
/*
@@ -51,7 +56,7 @@ long PyThread_start_new_thread(void (*func)(void *), void *arg)
5156
if (!initialized)
5257
PyThread_init_thread();
5358

54-
th = pth_spawn(PTH_ATTR_DEFAULT,
59+
th = pth_spawn(PyThread_attr,
5560
(void* (*)(void *))func,
5661
(void *)arg
5762
);

0 commit comments

Comments
 (0)