Re: Global flag

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Rajashree Mandaogane <rajashree(dot)28m(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Global flag
Date: 2014-03-24 11:59:08
Message-ID: 53301E0C.8020702@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/24/2014 06:28 PM, Rajashree Mandaogane wrote:
> I need to set a global flag in such a way that only if the flag is on
> then my modified code will get executed, so how can I do that?

PostgreSQL is single-threaded, multi-processing. So if you need to set
this flag only within a given backend, just make it a global variable.

If you want it to be global across all back-ends, you may want a GUC
(see the docs & source code). However, IIRC GUC changes aren't visible
to all backends immediately.

If you need something that's immediately visible, I imagine you'll want
a lock or mutex.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

  • Global flag at 2014-03-24 10:28:25 from Rajashree Mandaogane

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2014-03-24 12:51:07 Re: Patch for CREATE RULE sgml -- Was in: [DOCS]
Previous Message Fujii Masao 2014-03-24 11:59:01 Re: Standby server won't start