Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlojH-0006yN-Fb for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jul 2019 06:08:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlojG-0003qx-By for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jul 2019 06:08:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlojG-0003qX-1n for pgsql-hackers@lists.postgresql.org; Fri, 12 Jul 2019 06:08:22 +0000 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlojD-00057I-H6 for pgsql-hackers@postgresql.org; Fri, 12 Jul 2019 06:08:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1562911699; x=1594447699; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=r2YNVYT/t2sW6KDWuYyYp4q65WK7p70wqebR2th4Ycs=; b=EFQZBcZCJGqBbxvChqKsjHcWCJc0U/nF4J5H7SWMvHXa2j8lnP6SdTWq kd4SEauRZTuyfTLuCFu+XPfeP3fzqx9hdLN/ExffI7YFQf8KQtp+YAuhh Evg9TqQy/sNEEsJWP1CvBHPOBFyBcIzImf+hYVhqyfJiTj24vuu51hAQm Q=; X-IronPort-AV: E=Sophos;i="5.62,481,1554768000"; d="scan'208";a="404636012" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-e34f1ddc.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 12 Jul 2019 06:08:16 +0000 Received: from EX13MTAUWC001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-e34f1ddc.us-east-1.amazon.com (Postfix) with ESMTPS id 122D0A1E53; Fri, 12 Jul 2019 06:08:15 +0000 (UTC) Received: from EX13D05UWC002.ant.amazon.com (10.43.162.92) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 12 Jul 2019 06:08:15 +0000 Received: from f01898859afd.ant.amazon.com (10.43.162.67) by EX13D05UWC002.ant.amazon.com (10.43.162.92) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 12 Jul 2019 06:08:14 +0000 Date: Thu, 11 Jul 2019 23:08:13 -0700 From: Shawn Debnath To: Thomas Munro CC: Kyotaro HORIGUCHI , pgsql-hackers Subject: Re: Introduce timeout capability for ConditionVariableSleep Message-ID: <20190712060813.GA99189@f01898859afd.ant.amazon.com> References: <20190313005342.GA8301@f01898859afd.ant.amazon.com> <20190313.172415.156658364.horiguchi.kyotaro@lab.ntt.co.jp> <20190315002611.GA1119@f01898859afd.ant.amazon.com> <20190315.141517.229371570.horiguchi.kyotaro@lab.ntt.co.jp> <20190316222717.GA2139@f01898859afd.ant.amazon.com> <20190321182049.GA95415@f01898859afd.ant.amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Originating-IP: [10.43.162.67] X-ClientProxiedBy: EX13D21UWB004.ant.amazon.com (10.43.161.221) To EX13D05UWC002.ant.amazon.com (10.43.162.92) Precedence: Bulk List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jul 09, 2019 at 11:03:18PM +1200, Thomas Munro wrote: > On Sun, Jul 7, 2019 at 3:09 PM Thomas Munro wrote: > > + /* Timed out */ > > + if (rc == 0) > > + return true; > > Here's a version without that bit, because I don't think we need it. This works. Agree that letting it fall through covers the first gap. > > That still leaves the danger that the CV can be signalled some time > > after ConditionVariableTimedSleep() returns. So now I'm wondering if > > ConditionVariableCancelSleep() should signal the CV if it discovers > > that this process is not in the proclist, on the basis that that must > > indicate that we've been signalled even though we're not interested in > > the message anymore, and yet some other process else might be > > interested, and that might have been the only signal that is ever > > going to be delivered by ConditionVariableSignal(). > > And a separate patch to do that. Thoughts? I like it. This covers the gap all the way till cancel is invoked and it manipulates the list to remove itself or realizes that it needs to forward the signal to some other process. Thanks Thomas! -- Shawn Debnath Amazon Web Services (AWS)