diff options
author | Patrick Monnerat <patrick@monnerat.net> | 2022-07-15 17:18:32 +0200 |
---|---|---|
committer | Patrick Monnerat <patrick@monnerat.net> | 2022-08-18 11:56:38 +0200 |
commit | bac814af175e89d73b3bdda98d25d684ab5b3e7b (patch) | |
tree | 8aa4b054bcd72ab88ce80c53d2af6022fa4aafd9 /ld | |
parent | 8255dbf0dd513f39bc161f2d4cc945213fbe107e (diff) | |
download | gdb-bac814af175e89d73b3bdda98d25d684ab5b3e7b.zip gdb-bac814af175e89d73b3bdda98d25d684ab5b3e7b.tar.gz gdb-bac814af175e89d73b3bdda98d25d684ab5b3e7b.tar.bz2 |
gdbsupport/event-loop: add a timeout parameter to gdb_do_one_event
Since commit b2d8657, having a per-interpreter event/command loop is not
possible anymore.
As Insight uses a GUI that has its own event loop, gdb and GUI event
loops have then to be "merged" (i.e.: work together). But this is
problematic as gdb_do_one_event is not aware of this alternate event
loop and thus may wait forever.
A solution is to delegate GUI events handling to the gdb events handler.
Insight uses Tck/Tk as GUI and the latter offers a "notifier" feature to
implement such a delegation. The Tcl notifier spec requires the event wait
function to support a timeout parameter. Unfortunately gdb_do_one_event
does not feature such a parameter.
This timeout cannot be implemented externally with a gdb timer, because
it would become an event by itself and thus can cause a legitimate event to
be missed if the timeout is 0.
Tcl implements "idle events" that are (internally) triggered only when no
other event is pending. For this reason, it can call the event wait function
with a 0 timeout quite often.
This patch implements a wait timeout to gdb_do_one_event. The initial
pending events monitoring is performed as before without the possibility
to enter a wait state. If no pending event has been found during this
phase, a timer is then created for the given timeout in order to re-use
the implemented timeout logic and the event wait is then performed.
This "internal" timer only limits the wait time and should never be triggered.
It is deleted upon gdb_do_one_event exit.
The new parameter defaults to "no timeout" (-1): as it is used by Insight
only, there is no need to update calls from the gdb source tree.
Diffstat (limited to 'ld')
0 files changed, 0 insertions, 0 deletions