| От | Tom Lane |
|---|---|
| Тема | Re: User Level Lock question |
| Дата | |
| Msg-id | 21074.1016205095@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | User Level Lock question ("Lance Ellinghaus" <lellinghaus@yahoo.com>) |
| Список | pgsql-hackers |
"Lance Ellinghaus" <lellinghaus@yahoo.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
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера