public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Tom Tromey <tom@tromey.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH 5/6] gdb/continuations: use lambdas instead of function pointers
Date: Thu, 22 Apr 2021 14:07:49 +0000	[thread overview]
Message-ID: <SN6PR11MB2893CB79AFD8F4CA2E4209C7C4469@SN6PR11MB2893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <874kfya3gd.fsf@tromey.com>

On Thursday, April 22, 2021 2:50 PM, Tom Tromey wrote:
> >>>>> ">" == Aktemur, Tankut Baris <tankut.baris.aktemur@intel.com> writes:
> 
> >> The continuations at the moment are rather plain, but just in case a
> >> continuation in the future adds more continuations, delaying the pop
> >> could cause a wrong element to be popped, I'm afraid.  How about the
> >> following? (The same is to be used in Patch 6/6, too).
> 
> >> @@ -122,7 +39,12 @@ void
> >>  do_all_inferior_continuations ()
> >>  {
> >>    struct inferior *inf = current_inferior ();
> >> -  do_my_continuations (&inf->continuations);
> >> +  while (!inf->continuations.empty ())
> >> +    {
> >> +      auto iter = inf->continuations.begin ();
> >> +      (*iter) ();
> >> +      inf->continuations.erase (iter);
> 
> It took me a minute to see what was going on here, at first I misread it
> a bit.  But yeah, I see, I think this is fine.
> 
> If elements are only ever added/popped from the front, maybe
> std::forward_list is preferable.

If you don't mind it much, I'd like keep std::list.  With std::forward_list,
we would additionally have to use erase_after and before_begin, which make
the code uglier, in my opinion.

Thanks
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  reply	other threads:[~2021-04-22 14:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 12:57 [PATCH 0/6] Refactoring around inferior continuations Tankut Baris Aktemur
2021-04-21 12:57 ` [PATCH 1/6] gdb/infcmd: remove the unused parameter 'args' in 'attach_post_wait' Tankut Baris Aktemur
2021-04-21 19:24   ` Tom Tromey
2021-04-21 19:32     ` Simon Marchi
2021-04-21 19:47       ` Tom Tromey
2021-04-22  5:57         ` Aktemur, Tankut Baris
2021-04-21 12:57 ` [PATCH 2/6] gdb/infcmd: update the comment for 'attach_post_wait' Tankut Baris Aktemur
2021-04-21 19:25   ` Tom Tromey
2021-04-21 12:57 ` [PATCH 3/6] gdb/continuations: remove the 'err' from 'do_all_inferior_continuations' Tankut Baris Aktemur
2021-04-21 19:29   ` Tom Tromey
2021-04-21 12:57 ` [PATCH 4/6] gdb/continuations: do minor cleanup Tankut Baris Aktemur
2021-04-21 19:31   ` Tom Tromey
2021-04-21 12:57 ` [PATCH 5/6] gdb/continuations: use lambdas instead of function pointers Tankut Baris Aktemur
2021-04-21 19:43   ` Tom Tromey
2021-04-22  7:49     ` Aktemur, Tankut Baris
2021-04-22 12:50       ` Tom Tromey
2021-04-22 14:07         ` Aktemur, Tankut Baris [this message]
2021-04-22 14:12           ` Tom Tromey
2021-04-21 12:57 ` [PATCH 6/6] gdb/continuations: turn continuation functions into inferior methods Tankut Baris Aktemur
2021-04-21 19:46   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN6PR11MB2893CB79AFD8F4CA2E4209C7C4469@SN6PR11MB2893.namprd11.prod.outlook.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).