blob: c0a718e5ade187b7f3917688846d0347dbc1eb2b [file] [log] [blame]
Guido van Rossum1984f1e1992-08-04 12:41:02 +00001
Fred Drake3cf4d2b2000-07-09 00:55:06 +00002#ifndef Py_PYTHREAD_H
3#define Py_PYTHREAD_H
4
Guido van Rossum65d5b571998-12-21 19:32:43 +00005#define NO_EXIT_PROG /* don't define PyThread_exit_prog() */
Guido van Rossumb6775db1994-08-01 11:34:53 +00006 /* (the result is no use of signals on SGI) */
7
Guido van Rossum65d5b571998-12-21 19:32:43 +00008typedef void *PyThread_type_lock;
9typedef void *PyThread_type_sema;
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000010
11#ifdef __cplusplus
12extern "C" {
13#endif
14
Fred Drake3cf4d2b2000-07-09 00:55:06 +000015DL_IMPORT(void) PyThread_init_thread(void);
16DL_IMPORT(int) PyThread_start_new_thread(void (*)(void *), void *);
17DL_IMPORT(void) PyThread_exit_thread(void);
18DL_IMPORT(void) PyThread__PyThread_exit_thread(void);
19DL_IMPORT(long) PyThread_get_thread_ident(void);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000020
Fred Drake3cf4d2b2000-07-09 00:55:06 +000021DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock(void);
22DL_IMPORT(void) PyThread_free_lock(PyThread_type_lock);
23DL_IMPORT(int) PyThread_acquire_lock(PyThread_type_lock, int);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000024#define WAIT_LOCK 1
25#define NOWAIT_LOCK 0
Fred Drake3cf4d2b2000-07-09 00:55:06 +000026DL_IMPORT(void) PyThread_release_lock(PyThread_type_lock);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000027
Fred Drake3cf4d2b2000-07-09 00:55:06 +000028DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema(int);
29DL_IMPORT(void) PyThread_free_sema(PyThread_type_sema);
30DL_IMPORT(int) PyThread_down_sema(PyThread_type_sema, int);
Guido van Rossuma6351841996-10-08 14:21:49 +000031#define WAIT_SEMA 1
32#define NOWAIT_SEMA 0
Fred Drake3cf4d2b2000-07-09 00:55:06 +000033DL_IMPORT(void) PyThread_up_sema(PyThread_type_sema);
Guido van Rossumf9f2e821992-08-17 08:59:08 +000034
Guido van Rossumb6775db1994-08-01 11:34:53 +000035#ifndef NO_EXIT_PROG
Fred Drake3cf4d2b2000-07-09 00:55:06 +000036DL_IMPORT(void) PyThread_exit_prog(int);
37DL_IMPORT(void) PyThread__PyThread_exit_prog(int);
Guido van Rossumb6775db1994-08-01 11:34:53 +000038#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000039
Fred Drake3cf4d2b2000-07-09 00:55:06 +000040DL_IMPORT(int) PyThread_create_key(void);
41DL_IMPORT(void) PyThread_delete_key(int);
42DL_IMPORT(int) PyThread_set_key_value(int, void *);
43DL_IMPORT(void *) PyThread_get_key_value(int);
Guido van Rossuma027efa1997-05-05 20:56:21 +000044
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000045#ifdef __cplusplus
46}
47#endif
48
Guido van Rossumd023a781999-03-24 19:02:09 +000049#endif /* !Py_PYTHREAD_H */