2020#include <errno.h>
2121#endif
2222
23-
24- /* try to determine what version of the Pthread Standard is installed.
25- * this is important, since all sorts of parameter types changed from
26- * draft to draft and there are several (incompatible) drafts in
27- * common use. these macros are a start, at least.
28- * 12 May 1997 -- david arnold <[email protected] > 29- */
30-
31- #if defined(__ultrix ) && defined(__mips ) && defined(_DECTHREADS_ )
32- /* _DECTHREADS_ is defined in cma.h which is included by pthread.h */
33- # define PY_PTHREAD_D4
34- # error Systems with PY_PTHREAD_D4 are unsupported. See README.
35-
36- #elif defined(__osf__ ) && defined (__alpha )
37- /* _DECTHREADS_ is defined in cma.h which is included by pthread.h */
38- # if !defined(_PTHREAD_ENV_ALPHA ) || defined(_PTHREAD_USE_D4 ) || defined(PTHREAD_USE_D4 )
39- # define PY_PTHREAD_D4
40- # error Systems with PY_PTHREAD_D4 are unsupported. See README.
41- # else
42- # define PY_PTHREAD_STD
43- # endif
44-
45- #elif defined(_AIX )
46- /* SCHED_BG_NP is defined if using AIX DCE pthreads
47- * but it is unsupported by AIX 4 pthreads. Default
48- * attributes for AIX 4 pthreads equal to NULL. For
49- * AIX DCE pthreads they should be left unchanged.
50- */
51- # if !defined(SCHED_BG_NP )
52- # define PY_PTHREAD_STD
53- # else
54- # define PY_PTHREAD_D7
55- # error Systems with PY_PTHREAD_D7 are unsupported. See README.
56- # endif
57-
58- #elif defined(__hpux ) && defined(_DECTHREADS_ )
59- # define PY_PTHREAD_D4
60- # error Systems with PY_PTHREAD_D4 are unsupported. See README.
61-
62- #else /* Default case */
63- # define PY_PTHREAD_STD
64-
65- #endif
66-
67- /* set default attribute object for different versions */
68-
69- #if defined(PY_PTHREAD_D4 ) || defined(PY_PTHREAD_D7 )
70- #if !defined(pthread_attr_default )
71- # define pthread_attr_default pthread_attr_default
72- #endif
73- #if !defined(pthread_mutexattr_default )
74- # define pthread_mutexattr_default pthread_mutexattr_default
75- #endif
76- #if !defined(pthread_condattr_default )
77- # define pthread_condattr_default pthread_condattr_default
78- #endif
79- #elif defined(PY_PTHREAD_STD )
8023#if !defined(pthread_attr_default )
8124# define pthread_attr_default ((pthread_attr_t *)NULL)
8225#endif
8629#if !defined(pthread_condattr_default )
8730# define pthread_condattr_default ((pthread_condattr_t *)NULL)
8831#endif
89- #endif
9032
9133
9234/* Whether or not to use semaphores directly rather than emulating them with
@@ -203,23 +145,13 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
203145 SET_THREAD_SIGMASK (SIG_BLOCK , & newmask , & oldmask );
204146
205147 status = pthread_create (& th ,
206- #if defined(PY_PTHREAD_D4 )
207- pthread_attr_default ,
208- (pthread_startroutine_t )func ,
209- (pthread_addr_t )arg
210- #elif defined(PY_PTHREAD_D7 )
211- pthread_attr_default ,
212- func ,
213- arg
214- #elif defined(PY_PTHREAD_STD )
215148#if defined(THREAD_STACK_SIZE ) || defined (PTHREAD_SYSTEM_SCHED_SUPPORTED )
216149 & attrs ,
217150#else
218151 (pthread_attr_t * )NULL ,
219152#endif
220153 (void * (* )(void * ))func ,
221154 (void * )arg
222- #endif
223155 );
224156
225157 /* Restore signal mask for original thread */
@@ -231,11 +163,7 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
231163 if (status != 0 )
232164 return -1 ;
233165
234- #if defined(PY_PTHREAD_D4 ) || defined(PY_PTHREAD_D7 )
235- pthread_detach (& th );
236- #elif defined(PY_PTHREAD_STD )
237166 pthread_detach (th );
238- #endif
239167
240168#if SIZEOF_PTHREAD_T <= SIZEOF_LONG
241169 return (long ) th ;
0 commit comments