From: Tom Tromey <tom@tromey.com>
To: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
Cc: Tom Tromey <tom@tromey.com>,
"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 06:50:10 -0600 [thread overview]
Message-ID: <874kfya3gd.fsf@tromey.com> (raw)
In-Reply-To: <SN6PR11MB2893DA74A6BFB030FBFC5D58C4469@SN6PR11MB2893.namprd11.prod.outlook.com> (Tankut Baris Aktemur's message of "Thu, 22 Apr 2021 07:49:27 +0000")
>>>>> ">" == 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.
>> Out of curiosity, how do you pronounce 'std'? I was just thinking if it
>> should be "a std::function" or "an std::function". I pronounce std as
>> "ess-tee-dee" and "an" sounded more natural to me.
Hah, I didn't even think about that. In my head it sounds like "sted",
but that's just something I made up myself. Either way is fine by me,
or even just not referring to the type, since that's clear from context.
Tom
next prev parent reply other threads:[~2021-04-22 12:50 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 via Gdb-patches
2021-04-21 12:57 ` [PATCH 1/6] gdb/infcmd: remove the unused parameter 'args' in 'attach_post_wait' Tankut Baris Aktemur via Gdb-patches
2021-04-21 19:24 ` Tom Tromey
2021-04-21 19:32 ` Simon Marchi via Gdb-patches
2021-04-21 19:47 ` Tom Tromey
2021-04-22 5:57 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-21 12:57 ` [PATCH 2/6] gdb/infcmd: update the comment for 'attach_post_wait' Tankut Baris Aktemur via Gdb-patches
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 via Gdb-patches
2021-04-21 19:29 ` Tom Tromey
2021-04-21 12:57 ` [PATCH 4/6] gdb/continuations: do minor cleanup Tankut Baris Aktemur via Gdb-patches
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 via Gdb-patches
2021-04-21 19:43 ` Tom Tromey
2021-04-22 7:49 ` Aktemur, Tankut Baris via Gdb-patches
2021-04-22 12:50 ` Tom Tromey [this message]
2021-04-22 14:07 ` Aktemur, Tankut Baris via Gdb-patches
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 via Gdb-patches
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=874kfya3gd.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=tankut.baris.aktemur@intel.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