This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4]: Handle SIGINT under Python by raising KeyboardInterrupt


>>>>> "Yit" == Khoo Yit Phang <khooyp@cs.umd.edu> writes:

Yit> This looks like it might work, I'll give it a go and get back to
Yit> you. The only issue I see right now is if immediate_quit is set, it
Yit> could leave Python in a bad state (among other issues). Perhaps make
Yit> immediate_quit an argument of check_quit_flag?

I don't think it can cause problems.

handle_sigint calls set_quit_flag.  Then it (indirectly) calls
async_request_quit.

async_request_quit checks immediate_quit and, if it is set, calls quit.

Eventually quit calls throw_exception, which clears the quit flag.

If Python is enabled, all that will happen in the end is that
PyErr_CheckSignals will be called but have nothing to do.  This is no
big deal.

PyOS_InterruptOccurred and PyErr_SetInterrupt are ok to call without the
GIL and don't really involve any messing about with "true" Python state.
They (mostly) just manipulate some flags on the side.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]