Re: [HACKERS] nonblocking lock?

From: Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>
To: pablo(at)cs(dot)brandeis(dot)edu (Pablo Funes)
Cc: hackers(at)postgreSQL(dot)org (PostgreSQL Hackers)
Subject: Re: [HACKERS] nonblocking lock?
Date: 1999-06-02 10:23:47
Message-ID: 199906021023.MAA02397@nikita.wizard.net
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.

--
Massimo Dal Zotto

+----------------------------------------------------------------------+
| Massimo Dal Zotto email: dz(at)cs(dot)unitn(dot)it |
| Via Marconi, 141 phone: ++39-0461534251 |
| 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
| Italy pgp: finger dz(at)tango(dot)cs(dot)unitn(dot)it |
+----------------------------------------------------------------------+

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-06-02 11:49:11 Re: Rules puzzle with "current" keyword.
Previous Message Jan Wieck 1999-06-02 10:11:27 Re: Rules puzzle with "current" keyword.