diff options
author | Tom Tromey <tromey@redhat.com> | 2008-11-21 14:59:56 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2008-11-21 14:59:56 +0000 |
commit | ca30a76297419a1e0eac2ee6a709dff70d30e56a (patch) | |
tree | e13c237992ce5984085aee7f424db45b05c1dab9 /gdb/python/python-internal.h | |
parent | 3c9ab205d3020ddcb720946b4b7b1b6cc8de7bcb (diff) | |
download | gdb-ca30a76297419a1e0eac2ee6a709dff70d30e56a.zip gdb-ca30a76297419a1e0eac2ee6a709dff70d30e56a.tar.gz gdb-ca30a76297419a1e0eac2ee6a709dff70d30e56a.tar.bz2 |
* python/python-internal.h (PyGILState_Ensure): New define.
(PyGILState_Release): Likewise.
(PyEval_InitThreads): Likewise.
(PyThreadState_Swap): Likewise.
(PyEval_InitThreads): Likewise.
* python/python.c (_initialize_python): Initialize threads.
Release GIL.
(eval_python_from_control_command): Acquire GIL.
(python_command): Likewise.
* python/python-internal.h (make_cleanup_py_restore_gil):
Declare.
* python/python-utils.c (py_gil_restore): New function.
(make_cleanup_py_restore_gil): Likewise.
Diffstat (limited to 'gdb/python/python-internal.h')
-rw-r--r-- | gdb/python/python-internal.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 72f7a5f..dbc0a53 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -43,6 +43,17 @@ typedef Py_intptr_t Py_ssize_t; #error "Unable to find usable Python.h" #endif +/* If Python.h does not define WITH_THREAD, then the various + GIL-related functions will not be defined. However, + PyGILState_STATE will be. */ +#ifndef WITH_THREAD +#define PyGILState_Ensure() ((PyGILState_STATE) 0) +#define PyGILState_Release(ARG) (ARG) +#define PyEval_InitThreads() 0 +#define PyThreadState_Swap(ARG) (ARG) +#define PyEval_InitThreads() 0 +#endif + struct value; extern PyObject *gdb_module; @@ -57,6 +68,7 @@ struct value *convert_value_from_python (PyObject *obj); void gdbpy_initialize_values (void); struct cleanup *make_cleanup_py_decref (PyObject *py); +struct cleanup *make_cleanup_py_restore_gil (PyGILState_STATE *state); /* Use this after a TRY_EXCEPT to throw the appropriate Python exception. */ |