Guido van Rossum | d023a78 | 1999-03-24 19:02:09 +0000 | [diff] [blame] | 1 | /*********************************************************** |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 2 | Copyright (c) 2000, BeOpen.com. |
| 3 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
| 4 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
| 5 | All rights reserved. |
Guido van Rossum | d023a78 | 1999-03-24 19:02:09 +0000 | [diff] [blame] | 6 | |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 7 | See the file "Misc/COPYRIGHT" for information on usage and |
| 8 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
Guido van Rossum | d023a78 | 1999-03-24 19:02:09 +0000 | [diff] [blame] | 9 | ******************************************************************/ |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 10 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 11 | #ifndef Py_PYTHREAD_H |
| 12 | #define Py_PYTHREAD_H |
| 13 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 14 | #define NO_EXIT_PROG /* don't define PyThread_exit_prog() */ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 15 | /* (the result is no use of signals on SGI) */ |
| 16 | |
Guido van Rossum | 65d5b57 | 1998-12-21 19:32:43 +0000 | [diff] [blame] | 17 | typedef void *PyThread_type_lock; |
| 18 | typedef void *PyThread_type_sema; |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 19 | |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 24 | DL_IMPORT(void) PyThread_init_thread(void); |
| 25 | DL_IMPORT(int) PyThread_start_new_thread(void (*)(void *), void *); |
| 26 | DL_IMPORT(void) PyThread_exit_thread(void); |
| 27 | DL_IMPORT(void) PyThread__PyThread_exit_thread(void); |
| 28 | DL_IMPORT(long) PyThread_get_thread_ident(void); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 29 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 30 | DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock(void); |
| 31 | DL_IMPORT(void) PyThread_free_lock(PyThread_type_lock); |
| 32 | DL_IMPORT(int) PyThread_acquire_lock(PyThread_type_lock, int); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 33 | #define WAIT_LOCK 1 |
| 34 | #define NOWAIT_LOCK 0 |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 35 | DL_IMPORT(void) PyThread_release_lock(PyThread_type_lock); |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 36 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 37 | DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema(int); |
| 38 | DL_IMPORT(void) PyThread_free_sema(PyThread_type_sema); |
| 39 | DL_IMPORT(int) PyThread_down_sema(PyThread_type_sema, int); |
Guido van Rossum | a635184 | 1996-10-08 14:21:49 +0000 | [diff] [blame] | 40 | #define WAIT_SEMA 1 |
| 41 | #define NOWAIT_SEMA 0 |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 42 | DL_IMPORT(void) PyThread_up_sema(PyThread_type_sema); |
Guido van Rossum | f9f2e82 | 1992-08-17 08:59:08 +0000 | [diff] [blame] | 43 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 44 | #ifndef NO_EXIT_PROG |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 45 | DL_IMPORT(void) PyThread_exit_prog(int); |
| 46 | DL_IMPORT(void) PyThread__PyThread_exit_prog(int); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 47 | #endif |
Guido van Rossum | 1984f1e | 1992-08-04 12:41:02 +0000 | [diff] [blame] | 48 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 49 | DL_IMPORT(int) PyThread_create_key(void); |
| 50 | DL_IMPORT(void) PyThread_delete_key(int); |
| 51 | DL_IMPORT(int) PyThread_set_key_value(int, void *); |
| 52 | DL_IMPORT(void *) PyThread_get_key_value(int); |
Guido van Rossum | a027efa | 1997-05-05 20:56:21 +0000 | [diff] [blame] | 53 | |
Sjoerd Mullender | d10d829 | 1992-09-11 15:19:27 +0000 | [diff] [blame] | 54 | #ifdef __cplusplus |
| 55 | } |
| 56 | #endif |
| 57 | |
Guido van Rossum | d023a78 | 1999-03-24 19:02:09 +0000 | [diff] [blame] | 58 | #endif /* !Py_PYTHREAD_H */ |