1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-25 12:03:53 +03:00

Once again allow LWLocks to be used within DSM segments.

Prior to commit 7882c3b0b9, it was
possible to use LWLocks within DSM segments, but that commit broke
this use case by switching from a doubly linked list to a circular
linked list.  Switch back, using a new bit of general infrastructure
for maintaining lists of PGPROCs.

Thomas Munro, reviewed by me.
This commit is contained in:
Robert Haas
2016-08-15 18:09:55 -04:00
parent 2bf06f7561
commit b25b6c9701
6 changed files with 240 additions and 35 deletions

View File

@@ -18,7 +18,7 @@
#error "lwlock.h may not be included from frontend code"
#endif
#include "lib/ilist.h"
#include "storage/proclist_types.h"
#include "storage/s_lock.h"
#include "port/atomics.h"
@@ -59,7 +59,7 @@ typedef struct LWLock
{
uint16 tranche; /* tranche ID */
pg_atomic_uint32 state; /* state of exclusive/nonexclusive lockers */
dlist_head waiters; /* list of waiting PGPROCs */
proclist_head waiters; /* list of waiting PGPROCs */
#ifdef LOCK_DEBUG
pg_atomic_uint32 nwaiters; /* number of waiters */
struct PGPROC *owner; /* last exclusive owner of the lock */