| OLD | NEW |
| 1 | 1 |
| 2 /* Thread package. | 2 /* Thread package. |
| 3 This is intended to be usable independently from Python. | 3 This is intended to be usable independently from Python. |
| 4 The implementation for system foobar is in a file thread_foobar.h | 4 The implementation for system foobar is in a file thread_foobar.h |
| 5 which is included by this file dependent on config settings. | 5 which is included by this file dependent on config settings. |
| 6 Stuff shared by all thread_*.h files is collected here. */ | 6 Stuff shared by all thread_*.h files is collected here. */ |
| 7 | 7 |
| 8 #include "Python.h" | 8 #include "Python.h" |
| 9 | 9 |
| 10 | 10 |
| 11 #ifndef _POSIX_THREADS | 11 #ifndef _POSIX_THREADS |
| 12 /* This means pthreads are not implemented in libc headers, hence the macro | 12 /* This means pthreads are not implemented in libc headers, hence the macro |
| 13 not present in unistd.h. But they still can be implemented as an external | 13 not present in unistd.h. But they still can be implemented as an external |
| 14 library (e.g. gnu pth in pthread emulation) */ | 14 library (e.g. gnu pth in pthread emulation) */ |
| 15 # ifdef HAVE_PTHREAD_H | 15 # ifdef HAVE_PTHREAD_H |
| 16 # include <pthread.h> /* _POSIX_THREADS */ | 16 # include <pthread.h> /* _POSIX_THREADS */ |
| 17 # endif | 17 # endif |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 #ifndef DONT_HAVE_STDIO_H | 20 #ifndef DONT_HAVE_STDIO_H |
| 21 #include <stdio.h> | 21 #include <stdio.h> |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #include <stdlib.h> | 24 #include <stdlib.h> |
| 25 | 25 |
| 26 #include "pythread.h" | 26 #include "pythread.h" |
| 27 | 27 |
| 28 #ifndef _POSIX_THREADS | 28 #ifndef _POSIX_THREADS |
| 29 | |
| 30 #ifdef __sgi | |
| 31 #define SGI_THREADS | |
| 32 #endif | |
| 33 | |
| 34 #ifdef HAVE_THREAD_H | |
| 35 #define SOLARIS_THREADS | |
| 36 #endif | |
| 37 | |
| 38 #if defined(sun) && !defined(SOLARIS_THREADS) | |
| 39 #define SUN_LWP | |
| 40 #endif | |
| 41 | 29 |
| 42 /* Check if we're running on HP-UX and _SC_THREADS is defined. If so, then | 30 /* Check if we're running on HP-UX and _SC_THREADS is defined. If so, then |
| 43 enough of the Posix threads package is implemented to support python | 31 enough of the Posix threads package is implemented to support python |
| 44 threads. | 32 threads. |
| 45 | 33 |
| 46 This is valid for HP-UX 11.23 running on an ia64 system. If needed, add | 34 This is valid for HP-UX 11.23 running on an ia64 system. If needed, add |
| 47 a check of __ia64 to verify that we're running on a ia64 system instead | 35 a check of __ia64 to verify that we're running on a ia64 system instead |
| 48 of a pa-risc system. | 36 of a pa-risc system. |
| 49 */ | 37 */ |
| 50 #ifdef __hpux | 38 #ifdef __hpux |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return; | 74 return; |
| 87 initialized = 1; | 75 initialized = 1; |
| 88 dprintf(("PyThread_init_thread called\n")); | 76 dprintf(("PyThread_init_thread called\n")); |
| 89 PyThread__init_thread(); | 77 PyThread__init_thread(); |
| 90 } | 78 } |
| 91 | 79 |
| 92 /* Support for runtime thread stack size tuning. | 80 /* Support for runtime thread stack size tuning. |
| 93 A value of 0 means using the platform's default stack size | 81 A value of 0 means using the platform's default stack size |
| 94 or the size specified by the THREAD_STACK_SIZE macro. */ | 82 or the size specified by the THREAD_STACK_SIZE macro. */ |
| 95 static size_t _pythread_stacksize = 0; | 83 static size_t _pythread_stacksize = 0; |
| 96 | |
| 97 #ifdef SGI_THREADS | |
| 98 #error SGI Irix threads are now unsupported, and code will be removed in 3.3. | |
| 99 #include "thread_sgi.h" | |
| 100 #endif | |
| 101 | |
| 102 #ifdef SOLARIS_THREADS | |
| 103 #include "thread_solaris.h" | |
| 104 #endif | |
| 105 | |
| 106 #ifdef SUN_LWP | |
| 107 #error SunOS lightweight processes are now unsupported, and code will be removed
in 3.3. | |
| 108 #include "thread_lwp.h" | |
| 109 #endif | |
| 110 | |
| 111 #ifdef HAVE_PTH | |
| 112 #error GNU pth threads are now unsupported, and code will be removed in 3.3. | |
| 113 #include "thread_pth.h" | |
| 114 #undef _POSIX_THREADS | |
| 115 #endif | |
| 116 | 84 |
| 117 #ifdef _POSIX_THREADS | 85 #ifdef _POSIX_THREADS |
| 118 #include "thread_pthread.h" | 86 #include "thread_pthread.h" |
| 119 #endif | 87 #endif |
| 120 | 88 |
| 121 #ifdef C_THREADS | |
| 122 #error Mach C Threads are now unsupported, and code will be removed in 3.3. | |
| 123 #include "thread_cthread.h" | |
| 124 #endif | |
| 125 | |
| 126 #ifdef NT_THREADS | 89 #ifdef NT_THREADS |
| 127 #include "thread_nt.h" | 90 #include "thread_nt.h" |
| 128 #endif | 91 #endif |
| 129 | 92 |
| 130 #ifdef OS2_THREADS | 93 #ifdef OS2_THREADS |
| 131 #include "thread_os2.h" | 94 #include "thread_os2.h" |
| 132 #endif | |
| 133 | |
| 134 #ifdef PLAN9_THREADS | |
| 135 #include "thread_plan9.h" | |
| 136 #endif | 95 #endif |
| 137 | 96 |
| 138 /* | 97 /* |
| 139 #ifdef FOOBAR_THREADS | 98 #ifdef FOOBAR_THREADS |
| 140 #include "thread_foobar.h" | 99 #include "thread_foobar.h" |
| 141 #endif | 100 #endif |
| 142 */ | 101 */ |
| 143 | 102 |
| 144 /* return the current thread stack size */ | 103 /* return the current thread stack size */ |
| 145 size_t | 104 size_t |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 *q = p->next; | 361 *q = p->next; |
| 403 free((void *)p); | 362 free((void *)p); |
| 404 /* NB This does *not* free p->value! */ | 363 /* NB This does *not* free p->value! */ |
| 405 } | 364 } |
| 406 else | 365 else |
| 407 q = &p->next; | 366 q = &p->next; |
| 408 } | 367 } |
| 409 } | 368 } |
| 410 | 369 |
| 411 #endif /* Py_HAVE_NATIVE_TLS */ | 370 #endif /* Py_HAVE_NATIVE_TLS */ |
| OLD | NEW |