Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOxJP-009Y1d-W6 for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jul 2023 09:29:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qOxJO-0091TO-DX for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jul 2023 09:29:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOxJO-0091TF-4G for pgsql-hackers@lists.postgresql.org; Thu, 27 Jul 2023 09:29:34 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOxJH-001pgo-50 for pgsql-hackers@lists.postgresql.org; Thu, 27 Jul 2023 09:29:32 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 22B266078E; Thu, 27 Jul 2023 18:29:22 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 27 Jul 2023 18:29:22 +0900 From: Masahiro Ikeda To: Michael Paquier Cc: Tristan Partin , andres@anarazel.de, pgsql-hackers@lists.postgresql.org Subject: Re: Support to define custom wait events for extensions In-Reply-To: References: <97449ae1a3b2189934890f6d78b18216@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: ikedamsh@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, all. Sorry for late reply. > I am still mid-way through the review of the core APIs, but attached > is my current version in progress, labelled v8. I'll continue > tomorrow. I'm aware of some typos in the commit message of this > patch, and the dynamic bgworker launch is failing in the CI for > VS2019 (just too tired to finish debugging that today). I suspect that I forgot to specify "volatile" to the variable for the spinlock. +/* dynamic allocation counter for custom wait events for extensions */ +typedef struct WaitEventExtensionCounter +{ + int nextId; /* next ID to assign */ + slock_t mutex; /* protects the counter only */ +} WaitEventExtensionCounter; + +/* pointer to the shared memory */ +static WaitEventExtensionCounter * waitEventExtensionCounter; Regards, -- Masahiro Ikeda NTT DATA CORPORATION