Обсуждение: Global flag

Поиск
Список
Период
Сортировка

Global flag

От
Rajashree Mandaogane
Дата:
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.

Re: Global flag

От
Craig Ringer
Дата:
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