* event-loop.c (async_queue_event): Remove one parameter
	'position'.  Remove code handling 'position' == TAIL.
	(gdb_wait_for_event): Caller update.
	(check_async_event_handlers): Caller update.
	(poll_timers): Caller update.
	* event-loop.h (enum queue_position): Remove.
This commit is contained in:
Yao Qi 2013-01-25 14:14:18 +00:00
parent 60f662b0e8
commit 20ad88565a
3 changed files with 22 additions and 39 deletions

View File

@ -1,3 +1,12 @@
2013-01-25 Yao Qi <yao@codesourcery.com>
* event-loop.c (async_queue_event): Remove one parameter
'position'. Remove code handling 'position' == TAIL.
(gdb_wait_for_event): Caller update.
(check_async_event_handlers): Caller update.
(poll_timers): Caller update.
* event-loop.h (enum queue_position): Remove.
2013-01-25 Maxim Kuvyrkov <maxim@kugelworks.com> 2013-01-25 Maxim Kuvyrkov <maxim@kugelworks.com>
* MAINTAINERS: Update my email. * MAINTAINERS: Update my email.

View File

@ -274,9 +274,7 @@ static int gdb_wait_for_event (int);
static void poll_timers (void); static void poll_timers (void);
/* Insert an event object into the gdb event queue at /* Insert an event object into the gdb event queue.
the specified position.
POSITION can be head or tail, with values TAIL, HEAD.
EVENT_PTR points to the event to be inserted into the queue. EVENT_PTR points to the event to be inserted into the queue.
The caller must allocate memory for the event. It is freed The caller must allocate memory for the event. It is freed
after the event has ben handled. after the event has ben handled.
@ -285,9 +283,7 @@ static void poll_timers (void);
as last in first out. Event appended at the tail of the queue as last in first out. Event appended at the tail of the queue
will be processed first in first out. */ will be processed first in first out. */
static void static void
async_queue_event (gdb_event * event_ptr, queue_position position) async_queue_event (gdb_event * event_ptr)
{
if (position == TAIL)
{ {
/* The event will become the new last_event. */ /* The event will become the new last_event. */
@ -298,16 +294,6 @@ async_queue_event (gdb_event * event_ptr, queue_position position)
event_queue.last_event->next_event = event_ptr; event_queue.last_event->next_event = event_ptr;
event_queue.last_event = event_ptr; event_queue.last_event = event_ptr;
} }
else if (position == HEAD)
{
/* The event becomes the new first_event. */
event_ptr->next_event = event_queue.first_event;
if (event_queue.first_event == NULL)
event_queue.last_event = event_ptr;
event_queue.first_event = event_ptr;
}
}
/* Create a generic event, to be enqueued in the event queue for /* Create a generic event, to be enqueued in the event queue for
processing. PROC is the procedure associated to the event. DATA processing. PROC is the procedure associated to the event. DATA
@ -936,7 +922,7 @@ gdb_wait_for_event (int block)
if (file_ptr->ready_mask == 0) if (file_ptr->ready_mask == 0)
{ {
file_event_ptr = create_file_event (file_ptr->fd); file_event_ptr = create_file_event (file_ptr->fd);
async_queue_event (file_event_ptr, TAIL); async_queue_event (file_event_ptr);
} }
file_ptr->ready_mask = (gdb_notifier.poll_fds + i)->revents; file_ptr->ready_mask = (gdb_notifier.poll_fds + i)->revents;
} }
@ -972,7 +958,7 @@ gdb_wait_for_event (int block)
if (file_ptr->ready_mask == 0) if (file_ptr->ready_mask == 0)
{ {
file_event_ptr = create_file_event (file_ptr->fd); file_event_ptr = create_file_event (file_ptr->fd);
async_queue_event (file_event_ptr, TAIL); async_queue_event (file_event_ptr);
} }
file_ptr->ready_mask = mask; file_ptr->ready_mask = mask;
} }
@ -1158,7 +1144,7 @@ check_async_event_handlers (void)
data.ptr = hdata; data.ptr = hdata;
event_ptr = create_event (invoke_async_event_handler, data); event_ptr = create_event (invoke_async_event_handler, data);
async_queue_event (event_ptr, TAIL); async_queue_event (event_ptr);
} }
} }
} }
@ -1365,7 +1351,7 @@ poll_timers (void)
event_ptr = (gdb_event *) xmalloc (sizeof (gdb_event)); event_ptr = (gdb_event *) xmalloc (sizeof (gdb_event));
event_ptr->proc = handle_timer_event; event_ptr->proc = handle_timer_event;
event_ptr->data.integer = timer_list.first_timer->timer_id; event_ptr->data.integer = timer_list.first_timer->timer_id;
async_queue_event (event_ptr, TAIL); async_queue_event (event_ptr);
} }
/* Now we need to update the timeout for select/ poll, because /* Now we need to update the timeout for select/ poll, because

View File

@ -75,18 +75,6 @@ typedef void (sig_handler_func) (gdb_client_data);
typedef void (async_event_handler_func) (gdb_client_data); typedef void (async_event_handler_func) (gdb_client_data);
typedef void (timer_handler_func) (gdb_client_data); typedef void (timer_handler_func) (gdb_client_data);
/* Where to add an event onto the event queue, by queue_event. */
typedef enum
{
/* Add at tail of queue. It will be processed in first in first
out order. */
TAIL,
/* Add at head of queue. It will be processed in last in first
out order. */
HEAD
}
queue_position;
/* Exported functions from event-loop.c */ /* Exported functions from event-loop.c */
extern void start_event_loop (void); extern void start_event_loop (void);