Don't reference removed files in Makefile
[python/dscho.git] / Python / thread.c
blob2d80b097e9450ee4c23b1fca58e16af76810d6ab
1 /***********************************************************
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3 The Netherlands.
5 All Rights Reserved
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 not be used in advertising or publicity pertaining to
13 distribution of the software without specific, written prior permission.
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ******************************************************************/
25 /* Thread package.
26 This is intended to be usable independently from Python.
27 The implementation for system foobar is in a file thread_foobar.h
28 which is included by this file dependent on config settings.
29 Stuff shared by all thread_*.h files is collected here. */
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif
35 #include <stdio.h>
37 #ifdef HAVE_STDLIB_H
38 #include <stdlib.h>
39 #else
40 extern char *getenv();
41 #endif
43 #include "thread.h"
45 #ifdef __ksr__
46 #define _POSIX_THREADS
47 #endif
49 #ifndef _POSIX_THREADS
51 #ifdef __sgi
52 #define SGI_THREADS
53 #endif
55 #ifdef HAVE_THREAD_H
56 #define SOLARIS_THREADS
57 #endif
59 #if defined(sun) && !defined(SOLARIS_THREADS)
60 #define SUN_LWP
61 #endif
63 #endif /* _POSIX_THREADS */
65 #ifdef __STDC__
66 #define _P(args) args
67 #define _P0() (void)
68 #define _P1(v,t) (t)
69 #define _P2(v1,t1,v2,t2) (t1,t2)
70 #else
71 #define _P(args) ()
72 #define _P0() ()
73 #define _P1(v,t) (v) t;
74 #define _P2(v1,t1,v2,t2) (v1,v2) t1; t2;
75 #endif /* __STDC__ */
77 #ifdef DEBUG
78 static int thread_debug = 0;
79 #define dprintf(args) ((thread_debug & 1) && printf args)
80 #define d2printf(args) ((thread_debug & 8) && printf args)
81 #else
82 #define dprintf(args)
83 #define d2printf(args)
84 #endif
86 static int initialized;
88 static void _init_thread(); /* Forward */
90 void init_thread _P0()
92 #ifdef DEBUG
93 char *p = getenv("THREADDEBUG");
95 if (p) {
96 if (*p)
97 thread_debug = atoi(p);
98 else
99 thread_debug = 1;
101 #endif /* DEBUG */
102 if (initialized)
103 return;
104 initialized = 1;
105 dprintf(("init_thread called\n"));
106 _init_thread();
109 #ifdef SGI_THREADS
110 #include "thread_sgi.h"
111 #endif
113 #ifdef SOLARIS_THREADS
114 #include "thread_solaris.h"
115 #endif
117 #ifdef SUN_LWP
118 #include "thread_lwp.h"
119 #endif
121 #ifdef _POSIX_THREADS
122 #include "thread_pthread.h"
123 #endif
125 #ifdef C_THREADS
126 #include "thread_cthread.h"
127 #endif
129 #ifdef NT_THREADS
130 #include "thread_nt.h"
131 #endif
134 #ifdef FOOBAR_THREADS
135 #include "thread_foobar.h"
136 #endif