Global flag

Started by Rajashree Mandaoganealmost 12 years ago2 messages
#1Rajashree Mandaogane
rajashree.28m@gmail.com

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?

Thank you.

#2Craig Ringer
craig@2ndquadrant.com
In reply to: Rajashree Mandaogane (#1)
Re: Global flag

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers