/* Event loop machinery for GDB, the GNU debugger.
- Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
#include "gdb_assert.h"
#include "gdb_select.h"
+/* Tell create_file_handler what events we are interested in.
+ This is used by the select version of the event loop. */
+
+#define GDB_READABLE (1<<1)
+#define GDB_WRITABLE (1<<2)
+#define GDB_EXCEPTION (1<<3)
+
/* Data point to pass to the event handler. */
typedef union event_data
{
struct gdb_timer *next;
timer_handler_func *proc; /* Function to call to do the work */
gdb_client_data client_data; /* Argument to async_handler_func */
- }
-gdb_timer;
+ };
/* List of currently active timers. It is sorted in order of
increasing timers. */
gdb_client_data client_data);
static void handle_file_event (event_data data);
static void check_async_event_handlers (void);
-static void check_async_signal_handlers (void);
static int gdb_wait_for_event (int);
static void poll_timers (void);
\f
else
{
struct timeval select_timeout;
-
struct timeval *timeout_p;
+
if (block)
timeout_p = gdb_notifier.timeout_valid
? &gdb_notifier.select_timeout : NULL;
gettimeofday (&time_now, NULL);
- timer_ptr = (struct gdb_timer *) xmalloc (sizeof (gdb_timer));
+ timer_ptr = (struct gdb_timer *) xmalloc (sizeof (*timer_ptr));
timer_ptr->when.tv_sec = time_now.tv_sec + delta.tv_sec;
timer_ptr->when.tv_usec = time_now.tv_usec + delta.tv_usec;
/* carry? */