Re: User Level Lock question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Lance Ellinghaus" <lellinghaus(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: User Level Lock question
Date: 2002-03-15 15:11:35
Message-ID: 21074.1016205095@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Lance Ellinghaus" <lellinghaus(at)yahoo(dot)com> writes:
> Is there an easy way to test the lock on a user level lock without actually
> issuing the lock?

Why would you ever want to do such a thing? If you "test" the lock but
don't actually acquire it, someone else might acquire the lock half a
microsecond after you look at it --- and then what does your test result
mean? It's certainly unsafe to take any action based on assuming that
the lock is free.

I suspect what you really want is a conditional acquire, which you can
get (in recent versions) using the dontWait parameter to LockAcquire.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-03-15 15:43:25 Re: [HACKERS] Bug #613: Sequence values fall back to previously
Previous Message Tom Lane 2002-03-15 14:39:04 Re: Bug #613: Sequence values fall back to previously chec