This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] gdbserver: replace event_queue with QUEUE
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 24 Jan 2013 18:48:00 +0000
- Subject: Re: [PATCH 1/3] gdbserver: replace event_queue with QUEUE
- References: <1358990040-10962-1-git-send-email-yao@codesourcery.com>
On 01/24/2013 01:13 AM, Yao Qi wrote:
> -
> /* Process one event. If an event was processed, 1 is returned
> otherwise 0 is returned. Scan the queue from head to tail,
> processing therefore the high priority events first, by invoking
> @@ -199,46 +161,18 @@ async_queue_event (gdb_event *event_ptr)
> static int
> process_event (void)
> {
...
> - free (event_ptr);
> + gdb_event *event_ptr = QUEUE_deque (gdb_event_p, event_queue);
> + event_handler_func *proc = event_ptr->proc;
> + gdb_fildes_t fd = event_ptr->fd;
>
> + xfree (event_ptr);
I think here
gdb_event_xfree (event_ptr);
would be better.
> /* Start up the event loop. This is the entry point to the event
> loop. */
>
> void
> start_event_loop (void)
> {
> + event_queue = QUEUE_alloc (gdb_event_p, gdb_event_xfree);
This will go wrong if we ever nest event loops.
Can you put this in a initialize_event_loop function instead,
called from main, close to the initialize_low, etc. calls, please?
Okay with that change.
--
Pedro Alves