blob: 0fa8db04f021d9df7a1013e9517fb46096d71e8e [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
Mark Hammond91a681d2002-08-12 07:21:58 +000015PyAPI_FUNC(void) PyThread_init_thread(void);
16PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *);
17PyAPI_FUNC(void) PyThread_exit_thread(void);
18PyAPI_FUNC(void) PyThread__PyThread_exit_thread(void);
19PyAPI_FUNC(long) PyThread_get_thread_ident(void);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000020
Mark Hammond91a681d2002-08-12 07:21:58 +000021PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void);
22PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock);
23PyAPI_FUNC(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
Mark Hammond91a681d2002-08-12 07:21:58 +000026PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000027
Guido van Rossumb6775db1994-08-01 11:34:53 +000028#ifndef NO_EXIT_PROG
Mark Hammond91a681d2002-08-12 07:21:58 +000029PyAPI_FUNC(void) PyThread_exit_prog(int);
30PyAPI_FUNC(void) PyThread__PyThread_exit_prog(int);
Guido van Rossumb6775db1994-08-01 11:34:53 +000031#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000032
Mark Hammond8d98d2c2003-04-19 15:41:53 +000033/* Thread Local Storage (TLS) API */
Mark Hammond91a681d2002-08-12 07:21:58 +000034PyAPI_FUNC(int) PyThread_create_key(void);
35PyAPI_FUNC(void) PyThread_delete_key(int);
36PyAPI_FUNC(int) PyThread_set_key_value(int, void *);
37PyAPI_FUNC(void *) PyThread_get_key_value(int);
Mark Hammond8d98d2c2003-04-19 15:41:53 +000038PyAPI_FUNC(void) PyThread_delete_key_value(int key);
Guido van Rossuma027efa1997-05-05 20:56:21 +000039
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000040#ifdef __cplusplus
41}
42#endif
43
Guido van Rossumd023a781999-03-24 19:02:09 +000044#endif /* !Py_PYTHREAD_H */