blob: f26db160bf4bea53cca0c9f564850c64ab52c7b3 [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
Andrew MacIntyre92913322006-06-13 15:04:24 +000028PyAPI_FUNC(size_t) PyThread_get_stacksize(void);
29PyAPI_FUNC(int) PyThread_set_stacksize(size_t);
30
Guido van Rossumb6775db1994-08-01 11:34:53 +000031#ifndef NO_EXIT_PROG
Mark Hammond91a681d2002-08-12 07:21:58 +000032PyAPI_FUNC(void) PyThread_exit_prog(int);
33PyAPI_FUNC(void) PyThread__PyThread_exit_prog(int);
Guido van Rossumb6775db1994-08-01 11:34:53 +000034#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000035
Mark Hammond8d98d2c2003-04-19 15:41:53 +000036/* Thread Local Storage (TLS) API */
Mark Hammond91a681d2002-08-12 07:21:58 +000037PyAPI_FUNC(int) PyThread_create_key(void);
38PyAPI_FUNC(void) PyThread_delete_key(int);
39PyAPI_FUNC(int) PyThread_set_key_value(int, void *);
40PyAPI_FUNC(void *) PyThread_get_key_value(int);
Mark Hammond8d98d2c2003-04-19 15:41:53 +000041PyAPI_FUNC(void) PyThread_delete_key_value(int key);
Guido van Rossuma027efa1997-05-05 20:56:21 +000042
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000043#ifdef __cplusplus
44}
45#endif
46
Guido van Rossumd023a781999-03-24 19:02:09 +000047#endif /* !Py_PYTHREAD_H */