mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-17 07:40:07 +08:00
gdb: move gdbpy_gil into python-internal.h
Move gdbpy_gil class into python-internal.h, the next commit wants to make use of this class from a file other than python.c. Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -772,6 +772,30 @@ private:
|
||||
PyThreadState *m_save;
|
||||
};
|
||||
|
||||
/* A helper class to save and restore the GIL, but without touching
|
||||
the other globals that are handled by gdbpy_enter. */
|
||||
|
||||
class gdbpy_gil
|
||||
{
|
||||
public:
|
||||
|
||||
gdbpy_gil ()
|
||||
: m_state (PyGILState_Ensure ())
|
||||
{
|
||||
}
|
||||
|
||||
~gdbpy_gil ()
|
||||
{
|
||||
PyGILState_Release (m_state);
|
||||
}
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
|
||||
|
||||
private:
|
||||
|
||||
PyGILState_STATE m_state;
|
||||
};
|
||||
|
||||
/* Use this after a TRY_EXCEPT to throw the appropriate Python
|
||||
exception. */
|
||||
#define GDB_PY_HANDLE_EXCEPTION(Exception) \
|
||||
|
||||
Reference in New Issue
Block a user