Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 1 | #ifndef _THREAD_H_included |
| 2 | #define _THREAD_H_included |
| 3 | |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 4 | #ifndef PROTO |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 5 | #if defined(__STDC__) || defined(__cplusplus) |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 6 | #define PROTO(args) args |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 7 | #else |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 8 | #define PROTO(args) () |
| 9 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 10 | #endif |
| 11 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 12 | typedef void *type_lock; |
| 13 | typedef void *type_sema; |
| 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 19 | void init_thread PROTO((void)); |
| 20 | int start_new_thread PROTO((void (*)(void *), void *)); |
| 21 | void exit_thread PROTO((void)); |
| 22 | void _exit_thread PROTO((void)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 23 | |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 24 | type_lock allocate_lock PROTO((void)); |
| 25 | void free_lock PROTO((type_lock)); |
| 26 | int acquire_lock PROTO((type_lock, int)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 27 | #define WAIT_LOCK 1 |
| 28 | #define NOWAIT_LOCK 0 |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 29 | void release_lock PROTO((type_lock)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 30 | |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 31 | type_sema allocate_sema PROTO((int)); |
| 32 | void free_sema PROTO((type_sema)); |
| 33 | void down_sema PROTO((type_sema)); |
| 34 | void up_sema PROTO((type_sema)); |
Guido van Rossum | f9f2e82 | 1992-08-17 08:59:08 +0000 | [diff] [blame] | 35 | |
Sjoerd Mullender | 7030b1f | 1993-12-20 17:26:34 +0000 | [diff] [blame^] | 36 | void exit_prog PROTO((int)); |
| 37 | void _exit_prog PROTO((int)); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 38 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |
| 42 | |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 43 | #endif |