Re: Global flag - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: Global flag
Date
Msg-id 53301E0C.8020702@2ndquadrant.com
Whole thread Raw
In response to Global flag  (Rajashree Mandaogane <rajashree.28m@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Standby server won't start
Next
From: Fujii Masao
Date:
Subject: Re: Patch for CREATE RULE sgml -- Was in: [DOCS]