Re: dynamic shared memory and locks - Mailing list pgsql-hackers

From Tom Lane
Subject Re: dynamic shared memory and locks
Date
Msg-id 2790.1389020389@sss.pgh.pa.us
Whole thread Raw
In response to Re: dynamic shared memory and locks  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: dynamic shared memory and locks
Re: dynamic shared memory and locks
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2014-01-06 10:35:59 +0200, Heikki Linnakangas wrote:
>> That assumes that you never hold more than one spinlock at a time, otherwise
>> you can get deadlocks. I think that assumptions holds currently, because
>> acquiring two spinlocks at a time would be bad on performance grounds
>> anyway.

> I think that's a pretty dangerous assumption

I think it's a fine assumption.  Code that could possibly do that should
never get within hailing distance of being committed, because you are only
supposed to have short straight-line bits of code under a spinlock.
Taking another spinlock breaks both the "straight line code" and the "no
loops" aspects of that coding rule.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: generic pseudotype IO functions?
Next
From: Kevin Grittner
Date:
Subject: Re: [PATCH] SQL assertions prototype