mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-23 10:17:53 +08:00
* 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.
This commit is contained in:
@ -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. */
|
||||
|
Reference in New Issue
Block a user