From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id k5pzGSpGJmF6AQAAWB0awg (envelope-from ) for ; Wed, 25 Aug 2021 09:31:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 5721D1EE1A; Wed, 25 Aug 2021 09:31:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 881E51EDF0 for ; Wed, 25 Aug 2021 09:31:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AED003858427 for ; Wed, 25 Aug 2021 13:31:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AED003858427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629898280; bh=VWxIvrLk4qDi6snDVR+i7QfQ2pcqCMuh2gSs1bFhdik=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=fP05RAVYHrmznW3DZoHlR+kD/Jo05DHVlTQ7BLCWcGlvvEjuEsOfzSnkSpJQ1BI93 E7cNcwkHPzcnNTINSN/Md3ZnD8phL3il/6C5yY74tblcVccnmToADILbV6SX4ED+cU LpU/mEfnfyiaqkjm1eJY4bBnajF+N0CVvBZDEb+A= Received: from jupiter.monnerat.net (jupiter.monnerat.net [46.226.111.226]) by sourceware.org (Postfix) with ESMTPS id 590B83858D39 for ; Wed, 25 Aug 2021 13:30:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 590B83858D39 Received: from patrick.monnerat ([192.168.0.128]) by jupiter.monnerat.net (8.14.8/8.14.8) with ESMTP id 17PDUSnV008233 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Aug 2021 15:30:33 +0200 DKIM-Filter: OpenDKIM Filter v2.10.3 jupiter.monnerat.net 17PDUSnV008233 Subject: Re: [PATCH] Replace deprecated_target_wait_hook by an observer To: Andrew Burgess References: <20210822164256.144875-1-patrick@monnerat.net> <20210824161411.GE2581@embecosm.com> Message-ID: <3c65f6cf-0198-2efc-3db9-bbe8aafc58dc@monnerat.net> Date: Wed, 25 Aug 2021 15:30:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210824161411.GE2581@embecosm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Patrick Monnerat via Gdb-patches Reply-To: Patrick Monnerat Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 8/24/21 6:14 PM, Andrew Burgess wrote: > * Patrick Monnerat via Gdb-patches [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