Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 1 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 2 | #ifndef Py_PYTHREAD_H |
| 3 | #define Py_PYTHREAD_H |
| 4 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 5 | #define NO_EXIT_PROG /* don't define PyThread_exit_prog() */ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 6 | /* (the result is no use of signals on SGI) */ |
| 7 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 8 | typedef void *PyThread_type_lock; |
| 9 | typedef void *PyThread_type_sema; |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 15 | PyAPI_FUNC(void) PyThread_init_thread(void); |
| 16 | PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); |
| 17 | PyAPI_FUNC(void) PyThread_exit_thread(void); |
| 18 | PyAPI_FUNC(void) PyThread__PyThread_exit_thread(void); |
| 19 | PyAPI_FUNC(long) PyThread_get_thread_ident(void); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 20 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 21 | PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); |
| 22 | PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); |
| 23 | PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 24 | #define WAIT_LOCK 1 |
| 25 | #define NOWAIT_LOCK 0 |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 26 | PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 27 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 28 | #ifndef NO_EXIT_PROG |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 29 | PyAPI_FUNC(void) PyThread_exit_prog(int); |
| 30 | PyAPI_FUNC(void) PyThread__PyThread_exit_prog(int); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 31 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 32 | |
Mark Hammond | 8d98d2c | 2003-04-19 15:41:53 +0000 | [diff] [blame] | 33 | /* Thread Local Storage (TLS) API */ |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 34 | PyAPI_FUNC(int) PyThread_create_key(void); |
| 35 | PyAPI_FUNC(void) PyThread_delete_key(int); |
| 36 | PyAPI_FUNC(int) PyThread_set_key_value(int, void *); |
| 37 | PyAPI_FUNC(void *) PyThread_get_key_value(int); |
Mark Hammond | 8d98d2c | 2003-04-19 15:41:53 +0000 | [diff] [blame] | 38 | PyAPI_FUNC(void) PyThread_delete_key_value(int key); |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 39 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 40 | #ifdef __cplusplus |
| 41 | } |
| 42 | #endif |
| 43 | |
Guido van Rossum | d023a78 | 1999-03-24 19:02:09 +0000 | [diff] [blame] | 44 | #endif /* !Py_PYTHREAD_H */ |