blob: e40eb5759c3df0b2011593e5dabc0829519dcd43 [file] [log] [blame]
Guido van Rossumd023a781999-03-24 19:02:09 +00001/***********************************************************
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00002Copyright (c) 2000, BeOpen.com.
3Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5All rights reserved.
Guido van Rossumd023a781999-03-24 19:02:09 +00006
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00007See the file "Misc/COPYRIGHT" for information on usage and
8redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumd023a781999-03-24 19:02:09 +00009******************************************************************/
Guido van Rossum1984f1e1992-08-04 12:41:02 +000010
Fred Drake3cf4d2b2000-07-09 00:55:06 +000011#ifndef Py_PYTHREAD_H
12#define Py_PYTHREAD_H
13
Guido van Rossum65d5b571998-12-21 19:32:43 +000014#define NO_EXIT_PROG /* don't define PyThread_exit_prog() */
Guido van Rossumb6775db1994-08-01 11:34:53 +000015 /* (the result is no use of signals on SGI) */
16
Guido van Rossum65d5b571998-12-21 19:32:43 +000017typedef void *PyThread_type_lock;
18typedef void *PyThread_type_sema;
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000019
20#ifdef __cplusplus
21extern "C" {
22#endif
23
Fred Drake3cf4d2b2000-07-09 00:55:06 +000024DL_IMPORT(void) PyThread_init_thread(void);
25DL_IMPORT(int) PyThread_start_new_thread(void (*)(void *), void *);
26DL_IMPORT(void) PyThread_exit_thread(void);
27DL_IMPORT(void) PyThread__PyThread_exit_thread(void);
28DL_IMPORT(long) PyThread_get_thread_ident(void);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000029
Fred Drake3cf4d2b2000-07-09 00:55:06 +000030DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock(void);
31DL_IMPORT(void) PyThread_free_lock(PyThread_type_lock);
32DL_IMPORT(int) PyThread_acquire_lock(PyThread_type_lock, int);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000033#define WAIT_LOCK 1
34#define NOWAIT_LOCK 0
Fred Drake3cf4d2b2000-07-09 00:55:06 +000035DL_IMPORT(void) PyThread_release_lock(PyThread_type_lock);
Guido van Rossum1984f1e1992-08-04 12:41:02 +000036
Fred Drake3cf4d2b2000-07-09 00:55:06 +000037DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema(int);
38DL_IMPORT(void) PyThread_free_sema(PyThread_type_sema);
39DL_IMPORT(int) PyThread_down_sema(PyThread_type_sema, int);
Guido van Rossuma6351841996-10-08 14:21:49 +000040#define WAIT_SEMA 1
41#define NOWAIT_SEMA 0
Fred Drake3cf4d2b2000-07-09 00:55:06 +000042DL_IMPORT(void) PyThread_up_sema(PyThread_type_sema);
Guido van Rossumf9f2e821992-08-17 08:59:08 +000043
Guido van Rossumb6775db1994-08-01 11:34:53 +000044#ifndef NO_EXIT_PROG
Fred Drake3cf4d2b2000-07-09 00:55:06 +000045DL_IMPORT(void) PyThread_exit_prog(int);
46DL_IMPORT(void) PyThread__PyThread_exit_prog(int);
Guido van Rossumb6775db1994-08-01 11:34:53 +000047#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000048
Fred Drake3cf4d2b2000-07-09 00:55:06 +000049DL_IMPORT(int) PyThread_create_key(void);
50DL_IMPORT(void) PyThread_delete_key(int);
51DL_IMPORT(int) PyThread_set_key_value(int, void *);
52DL_IMPORT(void *) PyThread_get_key_value(int);
Guido van Rossuma027efa1997-05-05 20:56:21 +000053
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000054#ifdef __cplusplus
55}
56#endif
57
Guido van Rossumd023a781999-03-24 19:02:09 +000058#endif /* !Py_PYTHREAD_H */