Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xhpa9-0002f5-Tq for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Oct 2014 00:51:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xhpa8-0002bP-PM for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Oct 2014 00:51:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xhpa6-0002bE-5O for pgsql-hackers@postgresql.org; Sat, 25 Oct 2014 00:51:46 +0000 Received: from mail-by2on0615.outbound.protection.outlook.com ([2a01:111:f400:fc0c::615] helo=na01-by2-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xhpa0-0007yV-Gn for pgsql-hackers@postgresql.org; Sat, 25 Oct 2014 00:51:44 +0000 Received: from decina.local (24.55.12.91) by BN3PR11MB0179.namprd11.prod.outlook.com (25.160.185.17) with Microsoft SMTP Server (TLS) id 15.1.6.9; Sat, 25 Oct 2014 00:51:31 +0000 Message-ID: <544AF3FB.5000604@BlueTreble.com> Date: Fri, 24 Oct 2014 19:51:07 -0500 From: Jim Nasby User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Pg Hackers Subject: Comment patch for bgworker.c Content-Type: multipart/mixed; boundary="------------020407060101080109050905" X-Originating-IP: [24.55.12.91] X-ClientProxiedBy: SIXPR06CA0045.apcprd06.prod.outlook.com (25.160.171.163) To BN3PR11MB0179.namprd11.prod.outlook.com (25.160.185.17) X-MS-Exchange-Transport-FromEntityHeader: Hosted X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN3PR11MB0179; X-Exchange-Antispam-Report-Test: UriScan:; X-Forefront-PRVS: 0375972289 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(85306004)(512874002)(84326002)(92566001)(86362001)(31966008)(105586002)(40100003)(42186005)(77096002)(71186001)(19580395003)(65956001)(92726001)(110136001)(65806001)(15202345003)(102836001)(80316001)(64126003)(512934002)(66066001)(101416001)(21056001)(107046002)(106356001)(107886001)(229853001)(97736003)(33656002)(50986999)(36756003)(87266999)(54356999)(4396001)(95666004)(83506001)(65816999)(568964001)(16601075003)(20776003)(64706001)(80022003)(15975445006)(46102003)(85852003)(59896002)(87976001)(122386002)(99396003)(76482002)(120916001)(85282002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR11MB0179; H:decina.local; FPR:; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-OriginatorOrg: bluetreble.com X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --------------020407060101080109050905 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit The comment for the BackgroundWorkerSlot structure tripped me up reviewing Robert's background worker patch; it made it clear that you need to use a memory barrier before setting in_use, but normally you'd never need to worry about that because RegisterDynamicBackgroundWorker() handles it for you. Patch adds a comment to that effect. -- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com --------------020407060101080109050905 Content-Type: text/plain; charset="UTF-8"; x-mac-type=0; x-mac-creator=0; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch" diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c index 85a3b3a..e81dbc1 100644 --- a/src/backend/postmaster/bgworker.c +++ b/src/backend/postmaster/bgworker.c @@ -55,7 +55,8 @@ slist_head BackgroundWorkerList = SLIST_STATIC_INIT(BackgroundWorkerList); * responsibility of the postmaster. Regular backends may no longer modify it, * but the postmaster may examine it. Thus, a backend initializing a slot * must fully initialize the slot - and insert a write memory barrier - before - * marking it as in use. + * marking it as in use. Note that RegisterDynamicBackgroundWorker() handles + * in_use correctly for you. * * As an exception, however, even when the slot is in use, regular backends * may set the 'terminate' flag for a slot, telling the postmaster not --------------020407060101080109050905 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------020407060101080109050905--