Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 1 | #ifndef _THREAD_H_included |
| 2 | #define _THREAD_H_included |
| 3 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 4 | #define NO_EXIT_PROG /* don't define PyThread_exit_prog() */ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 5 | /* (the result is no use of signals on SGI) */ |
| 6 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 7 | #ifndef Py_PROTO |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 8 | #if defined(__STDC__) || defined(__cplusplus) |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 9 | #define Py_PROTO(args) args |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 10 | #else |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 11 | #define Py_PROTO(args) () |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame] | 12 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 13 | #endif |
| 14 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 15 | typedef void *PyThread_type_lock; |
| 16 | typedef void *PyThread_type_sema; |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 22 | DL_IMPORT(void) PyThread_init_thread Py_PROTO((void)); |
| 23 | 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] | 24 | DL_IMPORT(void) PyThread_exit_thread Py_PROTO((void)); |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 25 | DL_IMPORT(void) PyThread__PyThread_exit_thread Py_PROTO((void)); |
| 26 | DL_IMPORT(long) PyThread_get_thread_ident Py_PROTO((void)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 27 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 28 | DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock Py_PROTO((void)); |
| 29 | DL_IMPORT(void) PyThread_free_lock Py_PROTO((PyThread_type_lock)); |
| 30 | 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] | 31 | #define WAIT_LOCK 1 |
| 32 | #define NOWAIT_LOCK 0 |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 33 | DL_IMPORT(void) PyThread_release_lock Py_PROTO((PyThread_type_lock)); |
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 | DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema Py_PROTO((int)); |
| 36 | DL_IMPORT(void) PyThread_free_sema Py_PROTO((PyThread_type_sema)); |
| 37 | 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] | 38 | #define WAIT_SEMA 1 |
| 39 | #define NOWAIT_SEMA 0 |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 40 | DL_IMPORT(void) PyThread_up_sema Py_PROTO((PyThread_type_sema)); |
Guido van Rossum | f9f2e82 | 1992-08-17 08:59:08 +0000 | [diff] [blame] | 41 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 42 | #ifndef NO_EXIT_PROG |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 43 | DL_IMPORT(void) PyThread_exit_prog Py_PROTO((int)); |
| 44 | DL_IMPORT(void) PyThread__PyThread_exit_prog Py_PROTO((int)); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 45 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 46 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 47 | DL_IMPORT(int) PyThread_create_key Py_PROTO((void)); |
| 48 | DL_IMPORT(void) PyThread_delete_key Py_PROTO((int)); |
| 49 | DL_IMPORT(int) PyThread_set_key_value Py_PROTO((int, void *)); |
| 50 | DL_IMPORT(void *) PyThread_get_key_value Py_PROTO((int)); |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 51 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 52 | #ifdef __cplusplus |
| 53 | } |
| 54 | #endif |
| 55 | |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 56 | #endif |