blob: d38c174661caa3a9a014acb022ffd3df90de83a5 [file] [log] [blame]
Guido van Rossum1984f1e1992-08-04 12:41:02 +00001#ifndef _THREAD_H_included
2#define _THREAD_H_included
3
Guido van Rossumb6775db1994-08-01 11:34:53 +00004#define NO_EXIT_PROG /* don't define exit_prog() */
5 /* (the result is no use of signals on SGI) */
6
Guido van Rossumcaa63801995-01-12 11:45:45 +00007#ifndef Py_PROTO
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +00008#if defined(__STDC__) || defined(__cplusplus)
Guido van Rossumcaa63801995-01-12 11:45:45 +00009#define Py_PROTO(args) args
Guido van Rossum1984f1e1992-08-04 12:41:02 +000010#else
Guido van Rossumcaa63801995-01-12 11:45:45 +000011#define Py_PROTO(args) ()
Sjoerd Mullender7030b1f1993-12-20 17:26:34 +000012#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000013#endif
14
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000015typedef void *type_lock;
16typedef void *type_sema;
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
Guido van Rossum74277911997-03-14 04:24:08 +000022/* Macros defining new names for all these symbols */
Guido van Rossum1a8791e1998-08-04 22:46:29 +000023/* BeOS note: We have exit_thread(), and no legacy code to
24 * support, so we won't allow exit_thread and _exit_thread
25 * in here. Actually, I think these #defines should vanish;
26 * aren't they cheesy in the face of the Great Renaming? [cjh]
27 */
Guido van Rossum74277911997-03-14 04:24:08 +000028#define init_thread PyThread_init_thread
29#define start_new_thread PyThread_start_new_thread
Guido van Rossum1a8791e1998-08-04 22:46:29 +000030#ifndef __BEOS__
Guido van Rossum74277911997-03-14 04:24:08 +000031#define exit_thread PyThread_exit_thread
32#define _exit_thread PyThread__exit_thread
Guido van Rossum1a8791e1998-08-04 22:46:29 +000033#endif
Guido van Rossum74277911997-03-14 04:24:08 +000034#define get_thread_ident PyThread_get_thread_ident
35#define allocate_lock PyThread_allocate_lock
36#define free_lock PyThread_free_lock
37#define acquire_lock PyThread_acquire_lock
38#define release_lock PyThread_release_lock
39#define allocate_sema PyThread_allocate_sema
40#define free_sema PyThread_free_sema
41#define down_sema PyThread_down_sema
42#define up_sema PyThread_up_sema
43#define exit_prog PyThread_exit_prog
44#define _exit_prog PyThread__exit_prog
Guido van Rossuma027efa1997-05-05 20:56:21 +000045#define create_key PyThread_create_key
46#define delete_key PyThread_delete_key
47#define get_key_value PyThread_get_key_value
48#define set_key_value PyThread_set_key_value
Guido van Rossum74277911997-03-14 04:24:08 +000049
50
Guido van Rossumcaa63801995-01-12 11:45:45 +000051void init_thread Py_PROTO((void));
52int start_new_thread Py_PROTO((void (*)(void *), void *));
Guido van Rossum1a8791e1998-08-04 22:46:29 +000053#ifndef __BEOS__
Guido van Rossumcaa63801995-01-12 11:45:45 +000054void exit_thread Py_PROTO((void));
55void _exit_thread Py_PROTO((void));
Guido van Rossum1a8791e1998-08-04 22:46:29 +000056#else
57void PyThread_exit_thread Py_PROTO((void));
58void PyThread__exit_thread Py_PROTO((void));
59#endif
Guido van Rossumcaa63801995-01-12 11:45:45 +000060long get_thread_ident Py_PROTO((void));
Guido van Rossum1984f1e1992-08-04 12:41:02 +000061
Guido van Rossumcaa63801995-01-12 11:45:45 +000062type_lock allocate_lock Py_PROTO((void));
63void free_lock Py_PROTO((type_lock));
64int acquire_lock Py_PROTO((type_lock, int));
Guido van Rossum1984f1e1992-08-04 12:41:02 +000065#define WAIT_LOCK 1
66#define NOWAIT_LOCK 0
Guido van Rossumcaa63801995-01-12 11:45:45 +000067void release_lock Py_PROTO((type_lock));
Guido van Rossum1984f1e1992-08-04 12:41:02 +000068
Guido van Rossumcaa63801995-01-12 11:45:45 +000069type_sema allocate_sema Py_PROTO((int));
70void free_sema Py_PROTO((type_sema));
Guido van Rossuma6351841996-10-08 14:21:49 +000071int down_sema Py_PROTO((type_sema, int));
72#define WAIT_SEMA 1
73#define NOWAIT_SEMA 0
Guido van Rossumcaa63801995-01-12 11:45:45 +000074void up_sema Py_PROTO((type_sema));
Guido van Rossumf9f2e821992-08-17 08:59:08 +000075
Guido van Rossumb6775db1994-08-01 11:34:53 +000076#ifndef NO_EXIT_PROG
Guido van Rossumcaa63801995-01-12 11:45:45 +000077void exit_prog Py_PROTO((int));
78void _exit_prog Py_PROTO((int));
Guido van Rossumb6775db1994-08-01 11:34:53 +000079#endif
Guido van Rossum1984f1e1992-08-04 12:41:02 +000080
Guido van Rossuma027efa1997-05-05 20:56:21 +000081int create_key Py_PROTO((void));
82void delete_key Py_PROTO((int));
83int set_key_value Py_PROTO((int, void *));
84void * get_key_value Py_PROTO((int));
85
Sjoerd Mullenderd10d8291992-09-11 15:19:27 +000086#ifdef __cplusplus
87}
88#endif
89
Guido van Rossum1984f1e1992-08-04 12:41:02 +000090#endif