blob: c5048491e4c1428bcb12946d8f7035c88df1118f [file] [log] [blame]
Guido van Rossumd023a781999-03-24 19:02:09 +00001#ifndef Py_PYTHREAD_H
2#define Py_PYTHREAD_H
3
4/***********************************************************
5Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
6The Netherlands.
7
8 All Rights Reserved
9
10Permission to use, copy, modify, and distribute this software and its
11documentation for any purpose and without fee is hereby granted,
12provided that the above copyright notice appear in all copies and that
13both that copyright notice and this permission notice appear in
14supporting documentation, and that the names of Stichting Mathematisch
15Centrum or CWI or Corporation for National Research Initiatives or
16CNRI not be used in advertising or publicity pertaining to
17distribution of the software without specific, written prior
18permission.
19
20While CWI is the initial source for this software, a modified version
21is made available by the Corporation for National Research Initiatives
22(CNRI) at the Internet address ftp://ftp.python.org.
23
24STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
25REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
26MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
27CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
28DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
29PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
30TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
31PERFORMANCE OF THIS SOFTWARE.
32
33******************************************************************/
Guido van Rossum1984f1e1992-08-04 12:41:02 +000034
Guido van Rossum65d5b571998-12-21 19:32:43 +000035#define NO_EXIT_PROG /* don't define PyThread_exit_prog() */
Guido van Rossumb6775db1994-08-01 11:34:53 +000036 /* (the result is no use of signals on SGI) */
37
Guido van Rossumcaa63801995-01-12 11:45:45 +000038#ifndef Py_PROTO
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000039#if defined(__STDC__) || defined(__cplusplus)
Guido van Rossumcaa63801995-01-12 11:45:45 +000040#define Py_PROTO(args) args
Guido van Rossum1984f1e1992-08-04 12:41:02 +000041#else
Guido van Rossumcaa63801995-01-12 11:45:45 +000042#define Py_PROTO(args) ()
Sjoerd Mullender7030b1f1993-12-20 17:26:34 +000043#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000044#endif
45
Guido van Rossum65d5b571998-12-21 19:32:43 +000046typedef void *PyThread_type_lock;
47typedef void *PyThread_type_sema;
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000048
49#ifdef __cplusplus
50extern "C" {
51#endif
52
Guido van Rossum65d5b571998-12-21 19:32:43 +000053DL_IMPORT(void) PyThread_init_thread Py_PROTO((void));
54DL_IMPORT(int) PyThread_start_new_thread Py_PROTO((void (*)(void *), void *));
Guido van Rossum43466ec1998-12-04 18:48:25 +000055DL_IMPORT(void) PyThread_exit_thread Py_PROTO((void));
Guido van Rossum65d5b571998-12-21 19:32:43 +000056DL_IMPORT(void) PyThread__PyThread_exit_thread Py_PROTO((void));
57DL_IMPORT(long) PyThread_get_thread_ident Py_PROTO((void));
Guido van Rossum1984f1e1992-08-04 12:41:02 +000058
Guido van Rossum65d5b571998-12-21 19:32:43 +000059DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock Py_PROTO((void));
60DL_IMPORT(void) PyThread_free_lock Py_PROTO((PyThread_type_lock));
61DL_IMPORT(int) PyThread_acquire_lock Py_PROTO((PyThread_type_lock, int));
Guido van Rossum1984f1e1992-08-04 12:41:02 +000062#define WAIT_LOCK 1
63#define NOWAIT_LOCK 0
Guido van Rossum65d5b571998-12-21 19:32:43 +000064DL_IMPORT(void) PyThread_release_lock Py_PROTO((PyThread_type_lock));
Guido van Rossum1984f1e1992-08-04 12:41:02 +000065
Guido van Rossum65d5b571998-12-21 19:32:43 +000066DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema Py_PROTO((int));
67DL_IMPORT(void) PyThread_free_sema Py_PROTO((PyThread_type_sema));
68DL_IMPORT(int) PyThread_down_sema Py_PROTO((PyThread_type_sema, int));
Guido van Rossuma6351841996-10-08 14:21:49 +000069#define WAIT_SEMA 1
70#define NOWAIT_SEMA 0
Guido van Rossum65d5b571998-12-21 19:32:43 +000071DL_IMPORT(void) PyThread_up_sema Py_PROTO((PyThread_type_sema));
Guido van Rossumf9f2e821992-08-17 08:59:08 +000072
Guido van Rossumb6775db1994-08-01 11:34:53 +000073#ifndef NO_EXIT_PROG
Guido van Rossum65d5b571998-12-21 19:32:43 +000074DL_IMPORT(void) PyThread_exit_prog Py_PROTO((int));
75DL_IMPORT(void) PyThread__PyThread_exit_prog Py_PROTO((int));
Guido van Rossumb6775db1994-08-01 11:34:53 +000076#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000077
Guido van Rossum65d5b571998-12-21 19:32:43 +000078DL_IMPORT(int) PyThread_create_key Py_PROTO((void));
79DL_IMPORT(void) PyThread_delete_key Py_PROTO((int));
80DL_IMPORT(int) PyThread_set_key_value Py_PROTO((int, void *));
81DL_IMPORT(void *) PyThread_get_key_value Py_PROTO((int));
Guido van Rossuma027efa1997-05-05 20:56:21 +000082
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000083#ifdef __cplusplus
84}
85#endif
86
Guido van Rossumd023a781999-03-24 19:02:09 +000087#endif /* !Py_PYTHREAD_H */