Files for 2.1b1 distribution.
[python/dscho.git] / Include / pystate.h
blob27ffe32437f41a3606853426468bd35f60620bfb
2 /* Thread and interpreter state structures and their interfaces */
5 #ifndef Py_PYSTATE_H
6 #define Py_PYSTATE_H
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 /* State shared between threads */
13 struct _ts; /* Forward */
14 struct _is; /* Forward */
16 typedef struct _is {
18 struct _is *next;
19 struct _ts *tstate_head;
21 PyObject *modules;
22 PyObject *sysdict;
23 PyObject *builtins;
25 int checkinterval;
27 } PyInterpreterState;
30 /* State unique per thread */
32 struct _frame; /* Avoid including frameobject.h */
34 typedef struct _ts {
36 struct _ts *next;
37 PyInterpreterState *interp;
39 struct _frame *frame;
40 int recursion_depth;
41 int ticker;
42 int tracing;
44 PyObject *sys_profilefunc;
45 PyObject *sys_tracefunc;
47 PyObject *curexc_type;
48 PyObject *curexc_value;
49 PyObject *curexc_traceback;
51 PyObject *exc_type;
52 PyObject *exc_value;
53 PyObject *exc_traceback;
55 PyObject *dict;
57 /* XXX signal handlers should also be here */
59 } PyThreadState;
62 DL_IMPORT(PyInterpreterState *) PyInterpreterState_New(void);
63 DL_IMPORT(void) PyInterpreterState_Clear(PyInterpreterState *);
64 DL_IMPORT(void) PyInterpreterState_Delete(PyInterpreterState *);
66 DL_IMPORT(PyThreadState *) PyThreadState_New(PyInterpreterState *);
67 DL_IMPORT(void) PyThreadState_Clear(PyThreadState *);
68 DL_IMPORT(void) PyThreadState_Delete(PyThreadState *);
69 #ifdef WITH_THREAD
70 DL_IMPORT(void) PyThreadState_DeleteCurrent(void);
71 #endif
73 DL_IMPORT(PyThreadState *) PyThreadState_Get(void);
74 DL_IMPORT(PyThreadState *) PyThreadState_Swap(PyThreadState *);
75 DL_IMPORT(PyObject *) PyThreadState_GetDict(void);
78 /* Variable and macro for in-line access to current thread state */
80 extern DL_IMPORT(PyThreadState *) _PyThreadState_Current;
82 #ifdef Py_DEBUG
83 #define PyThreadState_GET() PyThreadState_Get()
84 #else
85 #define PyThreadState_GET() (_PyThreadState_Current)
86 #endif
88 #ifdef __cplusplus
90 #endif
91 #endif /* !Py_PYSTATE_H */