blob: dfd61575ea1095ae37cded560954a07c5ec3b215 [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 +00005typedef void *PyThread_type_lock;
6typedef void *PyThread_type_sema;
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +00007
8#ifdef __cplusplus
9extern "C" {
10#endif
11
Mark Hammond91a681d2002-08-12 07:21:58 +000012PyAPI_FUNC(void) PyThread_init_thread(void);
13PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *);
14PyAPI_FUNC(void) PyThread_exit_thread(void);
Mark Hammond91a681d2002-08-12 07:21:58 +000015PyAPI_FUNC(long) PyThread_get_thread_ident(void);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000016
Mark Hammond91a681d2002-08-12 07:21:58 +000017PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void);
18PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock);
19PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000020#define WAIT_LOCK 1
21#define NOWAIT_LOCK 0
Mark Hammond91a681d2002-08-12 07:21:58 +000022PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000023
Andrew MacIntyre92913322006-06-13 15:04:24 +000024PyAPI_FUNC(size_t) PyThread_get_stacksize(void);
25PyAPI_FUNC(int) PyThread_set_stacksize(size_t);
26
Mark Hammond8d98d2c2003-04-19 15:41:53 +000027/* Thread Local Storage (TLS) API */
Mark Hammond91a681d2002-08-12 07:21:58 +000028PyAPI_FUNC(int) PyThread_create_key(void);
29PyAPI_FUNC(void) PyThread_delete_key(int);
30PyAPI_FUNC(int) PyThread_set_key_value(int, void *);
31PyAPI_FUNC(void *) PyThread_get_key_value(int);
Mark Hammond8d98d2c2003-04-19 15:41:53 +000032PyAPI_FUNC(void) PyThread_delete_key_value(int key);
Guido van Rossuma027efa1997-05-05 20:56:21 +000033
Benjamin Peterson114f7e52008-06-13 00:09:47 +000034/* Cleanup after a fork */
35PyAPI_FUNC(void) PyThread_ReInitTLS(void);
36
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000037#ifdef __cplusplus
38}
39#endif
40
Guido van Rossumd023a781999-03-24 19:02:09 +000041#endif /* !Py_PYTHREAD_H */