1 /***********************************************************
2 Copyright (c) 2000, BeOpen.com.
3 Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4 Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
7 See the file "Misc/COPYRIGHT" for information on usage and
8 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9 ******************************************************************/
12 This is intended to be usable independently from Python.
13 The implementation for system foobar is in a file thread_foobar.h
14 which is included by this file dependent on config settings.
15 Stuff shared by all thread_*.h files is collected here. */
19 /* config.h may or may not define DL_IMPORT */
20 #ifndef DL_IMPORT /* declarations for DLL import/export */
21 #define DL_IMPORT(RTYPE) RTYPE
24 #ifndef DONT_HAVE_STDIO_H
32 extern char *getenv(const char *);
41 #define _USING_POSIX4A_DRAFT6
45 #ifndef HAVE_PTHREAD_H /* XXX Need to check in configure.in */
53 #define _POSIX_THREADS
56 #ifndef _POSIX_THREADS
63 #define SOLARIS_THREADS
66 #if defined(sun) && !defined(SOLARIS_THREADS)
71 #define _POSIX_THREADS
74 #endif /* _POSIX_THREADS */
78 static int thread_debug
= 0;
79 #define dprintf(args) ((thread_debug & 1) && printf args)
80 #define d2printf(args) ((thread_debug & 8) && printf args)
83 #define d2printf(args)
86 static int initialized
;
88 static void PyThread__init_thread(void); /* Forward */
90 void PyThread_init_thread(void)
93 char *p
= getenv("THREADDEBUG");
97 thread_debug
= atoi(p
);
101 #endif /* Py_DEBUG */
105 dprintf(("PyThread_init_thread called\n"));
106 PyThread__init_thread();
110 #include "thread_sgi.h"
113 #ifdef SOLARIS_THREADS
114 #include "thread_solaris.h"
118 #include "thread_lwp.h"
122 #include "thread_pth.h"
124 #ifdef _POSIX_THREADS
125 #include "thread_pthread.h"
130 #include "thread_cthread.h"
134 #include "thread_nt.h"
138 #include "thread_os2.h"
142 #include "thread_beos.h"
146 #include "thread_wince.h"
150 #ifdef FOOBAR_THREADS
151 #include "thread_foobar.h"