blob: 772f26b6f9f27316612b12656c7241e155d4f3a7 [file] [log] [blame]
Guido van Rossum2c8cb9f1994-05-09 15:12:46 +00001/***********************************************************
Guido van Rossum6d023c91995-01-04 19:12:13 +00002Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3The Netherlands.
Guido van Rossum2c8cb9f1994-05-09 15:12:46 +00004
5 All Rights Reserved
6
7Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
9provided that the above copyright notice appear in all copies and that
10both that copyright notice and this permission notice appear in
11supporting documentation, and that the names of Stichting Mathematisch
12Centrum or CWI not be used in advertising or publicity pertaining to
13distribution of the software without specific, written prior permission.
14
15STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
16THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
18FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
23******************************************************************/
24
25/*
26 * Initialization.
27 */
28static void _init_thread _P0()
29{
30}
31
32/*
33 * Thread support.
34 */
35int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
36{
37 int success = 0; /* init not needed when SOLARIS_THREADS and */
38 /* C_THREADS implemented properly */
39
40 dprintf(("start_new_thread called\n"));
41 if (!initialized)
42 init_thread();
43 return success < 0 ? 0 : 1;
44}
45
Guido van Rossume944da81994-05-23 12:43:41 +000046long get_thread_ident _P0()
47{
48 if (!initialized)
49 init_thread();
50}
51
Guido van Rossum2c8cb9f1994-05-09 15:12:46 +000052static void do_exit_thread _P1(no_cleanup, int no_cleanup)
53{
54 dprintf(("exit_thread called\n"));
55 if (!initialized)
56 if (no_cleanup)
57 _exit(0);
58 else
59 exit(0);
60}
61
62void exit_thread _P0()
63{
64 do_exit_thread(0);
65}
66
67void _exit_thread _P0()
68{
69 do_exit_thread(1);
70}
71
72#ifndef NO_EXIT_PROG
73static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
74{
75 dprintf(("exit_prog(%d) called\n", status));
76 if (!initialized)
77 if (no_cleanup)
78 _exit(status);
79 else
80 exit(status);
81}
82
83void exit_prog _P1(status, int status)
84{
85 do_exit_prog(status, 0);
86}
87
88void _exit_prog _P1(status, int status)
89{
90 do_exit_prog(status, 1);
91}
92#endif /* NO_EXIT_PROG */
93
94/*
95 * Lock support.
96 */
97type_lock allocate_lock _P0()
98{
99
100 dprintf(("allocate_lock called\n"));
101 if (!initialized)
102 init_thread();
103
104 dprintf(("allocate_lock() -> %lx\n", (long)lock));
105 return (type_lock) lock;
106}
107
108void free_lock _P1(lock, type_lock lock)
109{
110 dprintf(("free_lock(%lx) called\n", (long)lock));
111}
112
113int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
114{
115 int success;
116
117 dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
118 dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
119 return success;
120}
121
122void release_lock _P1(lock, type_lock lock)
123{
124 dprintf(("release_lock(%lx) called\n", (long)lock));
125}
126
127/*
128 * Semaphore support.
129 */
130type_sema allocate_sema _P1(value, int value)
131{
132 dprintf(("allocate_sema called\n"));
133 if (!initialized)
134 init_thread();
135
136 dprintf(("allocate_sema() -> %lx\n", (long) sema));
137 return (type_sema) sema;
138}
139
140void free_sema _P1(sema, type_sema sema)
141{
142 dprintf(("free_sema(%lx) called\n", (long) sema));
143}
144
145void down_sema _P1(sema, type_sema sema)
146{
147 dprintf(("down_sema(%lx) called\n", (long) sema));
148 dprintf(("down_sema(%lx) return\n", (long) sema));
149}
150
151void up_sema _P1(sema, type_sema sema)
152{
153 dprintf(("up_sema(%lx)\n", (long) sema));
154}