Guido van Rossum | d023a78 | 1999-03-24 19:02:09 +0000 | [diff] [blame] | 1 | #ifndef Py_PYTHREAD_H |
| 2 | #define Py_PYTHREAD_H |
| 3 | |
| 4 | /*********************************************************** |
| 5 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 6 | The Netherlands. |
| 7 | |
| 8 | All Rights Reserved |
| 9 | |
| 10 | Permission to use, copy, modify, and distribute this software and its |
| 11 | documentation for any purpose and without fee is hereby granted, |
| 12 | provided that the above copyright notice appear in all copies and that |
| 13 | both that copyright notice and this permission notice appear in |
| 14 | supporting documentation, and that the names of Stichting Mathematisch |
| 15 | Centrum or CWI or Corporation for National Research Initiatives or |
| 16 | CNRI not be used in advertising or publicity pertaining to |
| 17 | distribution of the software without specific, written prior |
| 18 | permission. |
| 19 | |
| 20 | While CWI is the initial source for this software, a modified version |
| 21 | is made available by the Corporation for National Research Initiatives |
| 22 | (CNRI) at the Internet address ftp://ftp.python.org. |
| 23 | |
| 24 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
| 25 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
| 26 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
| 27 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 28 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 29 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 30 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 31 | PERFORMANCE OF THIS SOFTWARE. |
| 32 | |
| 33 | ******************************************************************/ |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 34 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 35 | #define NO_EXIT_PROG /* don't define PyThread_exit_prog() */ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 36 | /* (the result is no use of signals on SGI) */ |
| 37 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 38 | #ifndef Py_PROTO |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 39 | #if defined(__STDC__) || defined(__cplusplus) |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 40 | #define Py_PROTO(args) args |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 41 | #else |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 42 | #define Py_PROTO(args) () |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame] | 43 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 44 | #endif |
| 45 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 46 | typedef void *PyThread_type_lock; |
| 47 | typedef void *PyThread_type_sema; |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 48 | |
| 49 | #ifdef __cplusplus |
| 50 | extern "C" { |
| 51 | #endif |
| 52 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 53 | DL_IMPORT(void) PyThread_init_thread Py_PROTO((void)); |
| 54 | DL_IMPORT(int) PyThread_start_new_thread Py_PROTO((void (*)(void *), void *)); |
Guido van Rossum | 43466ec | 1998-12-04 18:48:25 +0000 | [diff] [blame] | 55 | DL_IMPORT(void) PyThread_exit_thread Py_PROTO((void)); |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 56 | DL_IMPORT(void) PyThread__PyThread_exit_thread Py_PROTO((void)); |
| 57 | DL_IMPORT(long) PyThread_get_thread_ident Py_PROTO((void)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 58 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 59 | DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock Py_PROTO((void)); |
| 60 | DL_IMPORT(void) PyThread_free_lock Py_PROTO((PyThread_type_lock)); |
| 61 | DL_IMPORT(int) PyThread_acquire_lock Py_PROTO((PyThread_type_lock, int)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 62 | #define WAIT_LOCK 1 |
| 63 | #define NOWAIT_LOCK 0 |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 64 | DL_IMPORT(void) PyThread_release_lock Py_PROTO((PyThread_type_lock)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 65 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 66 | DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema Py_PROTO((int)); |
| 67 | DL_IMPORT(void) PyThread_free_sema Py_PROTO((PyThread_type_sema)); |
| 68 | DL_IMPORT(int) PyThread_down_sema Py_PROTO((PyThread_type_sema, int)); |
Guido van Rossum | a635184 | 1996-10-08 14:21:49 +0000 | [diff] [blame] | 69 | #define WAIT_SEMA 1 |
| 70 | #define NOWAIT_SEMA 0 |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 71 | DL_IMPORT(void) PyThread_up_sema Py_PROTO((PyThread_type_sema)); |
Guido van Rossum | f9f2e82 | 1992-08-17 08:59:08 +0000 | [diff] [blame] | 72 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 73 | #ifndef NO_EXIT_PROG |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 74 | DL_IMPORT(void) PyThread_exit_prog Py_PROTO((int)); |
| 75 | DL_IMPORT(void) PyThread__PyThread_exit_prog Py_PROTO((int)); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 76 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 77 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 78 | DL_IMPORT(int) PyThread_create_key Py_PROTO((void)); |
| 79 | DL_IMPORT(void) PyThread_delete_key Py_PROTO((int)); |
| 80 | DL_IMPORT(int) PyThread_set_key_value Py_PROTO((int, void *)); |
| 81 | DL_IMPORT(void *) PyThread_get_key_value Py_PROTO((int)); |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 82 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 83 | #ifdef __cplusplus |
| 84 | } |
| 85 | #endif |
| 86 | |
Guido van Rossum | d023a78 | 1999-03-24 19:02:09 +0000 | [diff] [blame] | 87 | #endif /* !Py_PYTHREAD_H */ |