Re: [HACKERS] nonblocking lock?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>
Cc: Pablo Funes <pablo(at)cs(dot)brandeis(dot)edu>, PostgreSQL Hackers <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] nonblocking lock?
Date: 1999-06-02 15:33:23
Message-ID: 199906021533.LAA22273@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > Is it possible to do a nonblocking lock? That is,
> > I want several clients to execute,
> >
> > begin
> > if table A is locked
> > then
> > go around doing stuff on other tables
> > else
> > lock A and do stuff on A
> > endif
> >
> > the problem is, if I use normal lock, then
> > after one client has locked and is doing stuff on A
> > the other one will block and thus it won't be able
> > to go around doing stuff on other tables. Is it
> > possible to do a nonblocking lock that will just
> > fail if the table is locked already?
>
> Try with user locks. You can find the code in contrib/userlocks.

Yes, this is the proper PostgreSQL solution.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Samersoff 1999-06-02 15:52:43 Re: [HACKERS] PID of backend
Previous Message Bruce Momjian 1999-06-02 15:31:40 Re: [HACKERS] 6.4.2/AIX: syslog support seems alright ?