mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
Patch #805613: Fix usage of the PTH library.
This commit is contained in:
parent
7bdc484c97
commit
70849f84a0
2 changed files with 7 additions and 1 deletions
|
|
@ -98,6 +98,7 @@ void PyThread_init_thread(void)
|
||||||
|
|
||||||
#ifdef HAVE_PTH
|
#ifdef HAVE_PTH
|
||||||
#include "thread_pth.h"
|
#include "thread_pth.h"
|
||||||
|
#undef _POSIX_THREADS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _POSIX_THREADS
|
#ifdef _POSIX_THREADS
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ typedef struct {
|
||||||
|
|
||||||
#define CHECK_STATUS(name) if (status == -1) { printf("%d ", status); perror(name); error = 1; }
|
#define CHECK_STATUS(name) if (status == -1) { printf("%d ", status); perror(name); error = 1; }
|
||||||
|
|
||||||
|
pth_attr_t PyThread_attr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialization.
|
* Initialization.
|
||||||
*/
|
*/
|
||||||
|
|
@ -37,6 +39,9 @@ typedef struct {
|
||||||
static void PyThread__init_thread(void)
|
static void PyThread__init_thread(void)
|
||||||
{
|
{
|
||||||
pth_init();
|
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)
|
if (!initialized)
|
||||||
PyThread_init_thread();
|
PyThread_init_thread();
|
||||||
|
|
||||||
th = pth_spawn(PTH_ATTR_DEFAULT,
|
th = pth_spawn(PyThread_attr,
|
||||||
(void* (*)(void *))func,
|
(void* (*)(void *))func,
|
||||||
(void *)arg
|
(void *)arg
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue