[RFA/mingw32] Adjust select emulation

Christopher Faylor me@cgf.cx
Mon Apr 10 20:59:00 GMT 2006


On Mon, Apr 10, 2006 at 01:47:56PM -0400, Daniel Jacobowitz wrote:
>This patch makes a couple of changes to the gdb_select emulation, to make
>it work more reliably:
>
>  - Check using ioctlsocket FIONREAD before starting a thread for network
>    sockets.  I'm not entirely sure that this change is responsible, but
>    something in this patch makes MinGW TCP debugging a whole lot faster,
>    and I think it's this.
>  - Check using _kbhit before starting a thread for consoles.  This
>    makes select return readable when getch() has returned \xE0 and is
>    holding on to the second half of an arrow or function key.  With
>    readline 5.1, this is necessary for arrow keys to be processed
>    in a timely fashion.
>  - Use simpler synchronization models for the select threads, by adding
>    an explicit "done now, go to sleep" step after gdb_select.  This
>    prevents race conditions between the network select thread and recv,
>    which could cause TCP communication to mysteriously lock up if you
>    were unlucky about how long your stub took to send a packet.
>
>I think it's much clearer now.  It definitely works better.
>
>Chris, does this look OK?

I just skimmed it but it looks ok.

cgf



More information about the Gdb-patches mailing list