1 /***********************************************************
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the names of Stichting Mathematisch
12 Centrum or CWI or Corporation for National Research Initiatives or
13 CNRI not be used in advertising or publicity pertaining to
14 distribution of the software without specific, written prior
17 While CWI is the initial source for this software, a modified version
18 is made available by the Corporation for National Research Initiatives
19 (CNRI) at the Internet address ftp://ftp.python.org.
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28 PERFORMANCE OF THIS SOFTWARE.
30 ******************************************************************/
33 This is intended to be usable independently from Python.
34 The implementation for system foobar is in a file thread_foobar.h
35 which is included by this file dependent on config settings.
36 Stuff shared by all thread_*.h files is collected here. */
40 /* config.h may or may not define DL_IMPORT */
41 #ifndef DL_IMPORT /* declarations for DLL import/export */
42 #define DL_IMPORT(RTYPE) RTYPE
45 #ifndef DONT_HAVE_STDIO_H
53 extern char *getenv();
62 #define _USING_POSIX4A_DRAFT6
66 #ifndef HAVE_PTHREAD_H /* XXX Need to check in configure.in */
74 #define _POSIX_THREADS
77 #ifndef _POSIX_THREADS
84 #define SOLARIS_THREADS
87 #if defined(sun) && !defined(SOLARIS_THREADS)
91 #endif /* _POSIX_THREADS */
97 #define _P2(v1,t1,v2,t2) (t1,t2)
101 #define _P1(v,t) (v) t;
102 #define _P2(v1,t1,v2,t2) (v1,v2) t1; t2;
103 #endif /* __STDC__ */
106 static int thread_debug
= 0;
107 #define dprintf(args) ((thread_debug & 1) && printf args)
108 #define d2printf(args) ((thread_debug & 8) && printf args)
110 #define dprintf(args)
111 #define d2printf(args)
114 static int initialized
;
116 static void PyThread__init_thread(); /* Forward */
118 void PyThread_init_thread
_P0()
121 char *p
= getenv("THREADDEBUG");
125 thread_debug
= atoi(p
);
129 #endif /* Py_DEBUG */
133 dprintf(("PyThread_init_thread called\n"));
134 PyThread__init_thread();
138 #include "thread_sgi.h"
141 #ifdef SOLARIS_THREADS
142 #include "thread_solaris.h"
146 #include "thread_lwp.h"
149 #ifdef _POSIX_THREADS
150 #include "thread_pthread.h"
154 #include "thread_cthread.h"
158 #include "thread_nt.h"
162 #include "thread_os2.h"
166 #include "thread_beos.h"
170 #include "thread_wince.h"
174 #ifdef FOOBAR_THREADS
175 #include "thread_foobar.h"