public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Patrick Monnerat <patrick@monnerat.net>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Replace deprecated_target_wait_hook by an observer
Date: Wed, 25 Aug 2021 15:30:28 +0200	[thread overview]
Message-ID: <3c65f6cf-0198-2efc-3db9-bbe8aafc58dc@monnerat.net> (raw)
In-Reply-To: <20210824161411.GE2581@embecosm.com>


On 8/24/21 6:14 PM, Andrew Burgess wrote:
> * Patrick Monnerat via Gdb-patches <gdb-patches@sourceware.org> [2021-08-22 18:42:56 +0200]:
>
>> +DEFINE_OBSERVABLE (waiting_for_target);
> Given we already have events 'target_changed' and 'target_resumed', I
> wonder if it would be more consistent to name this event 'target_wait'?
>
Yes, it's possible. Here are the two reasons why I did not name this 
observer 'target_wait':

1) Because the observer is not supposed to wait by itself, I fear it 
will be a source of confusion.

2) As a good old C programmer, I still have some reluctance naming an 
object as a global procedure. Not being declared in the same namespace 
though!

Comments are welcome!

>>   
>> -  return target->wait (ptid, status, options);
>> +  gdb::observers::waiting_for_target.notify (true, ptid);
>> +  event_ptid = target->wait (ptid, status, options);
>> +  gdb::observers::waiting_for_target.notify (false, event_ptid);
>> +  return event_ptid;
> I would be tempted to wrap this notification inside an RAII class,
> then we will be guaranteed to send the second notification, even in
> the event that the wait call exits via an exception.

That would make sense, but in case we have an exception, event_ptid is 
not known. How would you handle it? pass it as null_ptid?

Thanks for review,

Patrick


  reply	other threads:[~2021-08-25 13:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 16:42 Patrick Monnerat
2021-08-23 16:26 ` Simon Marchi
2021-08-23 17:36   ` Patrick Monnerat
2021-08-23 17:48     ` Simon Marchi
2021-08-23 18:01       ` Patrick Monnerat
2021-08-24 16:14 ` Andrew Burgess
2021-08-25 13:30   ` Patrick Monnerat [this message]
2021-08-25 16:19     ` Andrew Burgess
2021-08-26  2:41       ` Simon Marchi
2021-08-26 10:53         ` Patrick Monnerat

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=3c65f6cf-0198-2efc-3db9-bbe8aafc58dc@monnerat.net \
    --to=patrick@monnerat.net \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /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).