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 | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 4 | #define NO_EXIT_PROG /* don't define exit_prog() */ |
| 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 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 15 | typedef void *type_lock; |
| 16 | typedef void *type_sema; |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 22 | void init_thread Py_PROTO((void)); |
| 23 | int start_new_thread Py_PROTO((void (*)(void *), void *)); |
| 24 | void exit_thread Py_PROTO((void)); |
| 25 | void _exit_thread Py_PROTO((void)); |
| 26 | long get_thread_ident Py_PROTO((void)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 27 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 28 | type_lock allocate_lock Py_PROTO((void)); |
| 29 | void free_lock Py_PROTO((type_lock)); |
| 30 | int acquire_lock Py_PROTO((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 | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 33 | void release_lock Py_PROTO((type_lock)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 34 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 35 | type_sema allocate_sema Py_PROTO((int)); |
| 36 | void free_sema Py_PROTO((type_sema)); |
Guido van Rossum | a635184 | 1996-10-08 14:21:49 +0000 | [diff] [blame] | 37 | int down_sema Py_PROTO((type_sema, int)); |
| 38 | #define WAIT_SEMA 1 |
| 39 | #define NOWAIT_SEMA 0 |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 40 | void up_sema Py_PROTO((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 | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 43 | void exit_prog Py_PROTO((int)); |
| 44 | void _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 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 47 | #ifdef __cplusplus |
| 48 | } |
| 49 | #endif |
| 50 | |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 51 | #endif |