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 | 7427791 | 1997-03-14 04:24:08 +0000 | [diff] [blame] | 22 | /* Macros defining new names for all these symbols */ |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 23 | /* BeOS note: We have exit_thread(), and no legacy code to |
| 24 | * support, so we won't allow exit_thread and _exit_thread |
| 25 | * in here. Actually, I think these #defines should vanish; |
| 26 | * aren't they cheesy in the face of the Great Renaming? [cjh] |
| 27 | */ |
Guido van Rossum | 7427791 | 1997-03-14 04:24:08 +0000 | [diff] [blame] | 28 | #define init_thread PyThread_init_thread |
| 29 | #define start_new_thread PyThread_start_new_thread |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 30 | #ifndef __BEOS__ |
Guido van Rossum | 7427791 | 1997-03-14 04:24:08 +0000 | [diff] [blame] | 31 | #define exit_thread PyThread_exit_thread |
| 32 | #define _exit_thread PyThread__exit_thread |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 33 | #endif |
Guido van Rossum | 7427791 | 1997-03-14 04:24:08 +0000 | [diff] [blame] | 34 | #define get_thread_ident PyThread_get_thread_ident |
| 35 | #define allocate_lock PyThread_allocate_lock |
| 36 | #define free_lock PyThread_free_lock |
| 37 | #define acquire_lock PyThread_acquire_lock |
| 38 | #define release_lock PyThread_release_lock |
| 39 | #define allocate_sema PyThread_allocate_sema |
| 40 | #define free_sema PyThread_free_sema |
| 41 | #define down_sema PyThread_down_sema |
| 42 | #define up_sema PyThread_up_sema |
| 43 | #define exit_prog PyThread_exit_prog |
| 44 | #define _exit_prog PyThread__exit_prog |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 45 | #define create_key PyThread_create_key |
| 46 | #define delete_key PyThread_delete_key |
| 47 | #define get_key_value PyThread_get_key_value |
| 48 | #define set_key_value PyThread_set_key_value |
Guido van Rossum | 7427791 | 1997-03-14 04:24:08 +0000 | [diff] [blame] | 49 | |
| 50 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 51 | void init_thread Py_PROTO((void)); |
| 52 | int start_new_thread Py_PROTO((void (*)(void *), void *)); |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 53 | #ifndef __BEOS__ |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 54 | void exit_thread Py_PROTO((void)); |
| 55 | void _exit_thread Py_PROTO((void)); |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 56 | #else |
| 57 | void PyThread_exit_thread Py_PROTO((void)); |
| 58 | void PyThread__exit_thread Py_PROTO((void)); |
| 59 | #endif |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 60 | long get_thread_ident Py_PROTO((void)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 61 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 62 | type_lock allocate_lock Py_PROTO((void)); |
| 63 | void free_lock Py_PROTO((type_lock)); |
| 64 | int acquire_lock Py_PROTO((type_lock, int)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 65 | #define WAIT_LOCK 1 |
| 66 | #define NOWAIT_LOCK 0 |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 67 | void release_lock Py_PROTO((type_lock)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 68 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 69 | type_sema allocate_sema Py_PROTO((int)); |
| 70 | void free_sema Py_PROTO((type_sema)); |
Guido van Rossum | a635184 | 1996-10-08 14:21:49 +0000 | [diff] [blame] | 71 | int down_sema Py_PROTO((type_sema, int)); |
| 72 | #define WAIT_SEMA 1 |
| 73 | #define NOWAIT_SEMA 0 |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 74 | void up_sema Py_PROTO((type_sema)); |
Guido van Rossum | f9f2e82 | 1992-08-17 08:59:08 +0000 | [diff] [blame] | 75 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 76 | #ifndef NO_EXIT_PROG |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 77 | void exit_prog Py_PROTO((int)); |
| 78 | void _exit_prog Py_PROTO((int)); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 79 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 80 | |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 81 | int create_key Py_PROTO((void)); |
| 82 | void delete_key Py_PROTO((int)); |
| 83 | int set_key_value Py_PROTO((int, void *)); |
| 84 | void * get_key_value Py_PROTO((int)); |
| 85 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 86 | #ifdef __cplusplus |
| 87 | } |
| 88 | #endif |
| 89 | |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 90 | #endif |