This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] gdbserver: replace event_queue with QUEUE


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]