[RFA] New gdb_usleep function?

Joel Brobecker brobecker@adacore.com
Tue Mar 17 17:25:00 GMT 2009


Hello guys,

I'm working on a patch for AIX where I need to do a timed-delay.
I could do what I always do, which is call gdb_select, but I thought
that this something we do occasionally, so I think it'd be nice to
have a function that does everything for us.  This is why I came up
with gdb_usleep.

As explained in the "Limitation:" comment, the function is not perfect,
since it might return early if a signal is raised.  But I think it's
good enough for what we need to do, at least thus far.  I think it can
be enhanced by checking the time remaining, but I'm not certain that
this is completely portable.

2009-03-17  Joel Brobecker  <brobecker@adacore.com>

        Add gdb_usleep as a portable version of sleep based on gdb_select.

        * gdb_usleep.h, gdb_usleep.c: New files.
        * Makefile.in (SFILES): Add gdb_usleep.c.
        (HFILES_NO_SRCDIR): Add gdb_usleep.h.
        (COMMON_OBS): Add gdb_usleep.o.
        * ser-unix.c (hardwire_send_break): Replace call to gdb_select
        by call to gdb_usleep.

Tested in amd64-linux. Any objection?

-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb_usleep.diff
Type: text/x-diff
Size: 4483 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20090317/823a7c7d/attachment.bin>


More information about the Gdb-patches mailing list