Difficult while acquiring LWLocks

Started by hariprasath nallasamyalmost 9 years ago4 messagesgeneral
Jump to latest
#1hariprasath nallasamy
hariprasathnallasamy@gmail.com

Hi all
There is an use case, where i want some 10 LightWeight Locks and after
9.6 LW locks api's (LWLockAssign) are changed a bit and i am confused too.

Only reference i cant get was from pg_stat_statement :(

Since GetNamedLWLockTranche method will return the base address of the
specified tranche.

From pg_init

*" RequestNamedLWLockTranche("Some_10_LWLocks", 10); "*For getting those
locks which were requested from pg_init

*" LWLockPadded *lwLockPadded = GetNamedLWLockTranche("Some_10_LWLocks");
LWLock *lock = &(lwLockPadded[index in 0 to 9]).lock; "*

Is the above code snippet a valid for requesting some 10 LWLocks?

TIA
harry

#2Julien Rouhaud
rjuju123@gmail.com
In reply to: hariprasath nallasamy (#1)
Re: Difficult while acquiring LWLocks

On 03/05/2017 13:08, hariprasath nallasamy wrote:

Hi all
There is an use case, where i want some 10 LightWeight Locks and
after 9.6 LW locks api's (LWLockAssign) are changed a bit and i am
confused too.

Only reference i cant get was from pg_stat_statement :(

Since GetNamedLWLockTranche method will return the base address of the
specified tranche.

From pg_init
*" RequestNamedLWLockTranche("Some_10_LWLocks", 10); "

*For getting those locks which were requested from pg_init
*" LWLockPadded *lwLockPadded = GetNamedLWLockTranche("Some_10_LWLocks");
LWLock *lock = &(lwLockPadded[index in 0 to 9]).lock; "*

Is the above code snippet a valid for requesting some 10 LWLocks?

AFAIK yes this is the correct way to use multiple lwlocks.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

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

#3hariprasath nallasamy
hariprasathnallasamy@gmail.com
In reply to: Julien Rouhaud (#2)
Re: Difficult while acquiring LWLocks

AFAIK yes this is the correct way to use multiple lwlocks.

Thanks.!

Just curious, Is there any other way to do this.?

#4Julien Rouhaud
rjuju123@gmail.com
In reply to: hariprasath nallasamy (#3)
Re: Difficult while acquiring LWLocks

On 03/05/2017 15:01, hariprasath nallasamy wrote:

AFAIK yes this is the correct way to use multiple lwlocks.

Thanks.!

Just curious, Is there any other way to do this.?

Probably no, except asking for 10 different tranches :)

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

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