summaryrefslogtreecommitdiff
path: root/src/include/storage/lwlock.h
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2014-12-25 17:24:30 +0100
committerAndres Freund <andres@anarazel.de>2014-12-25 17:24:30 +0100
commit7882c3b0b95640e361f1533fe0f2d02e4e5d8610 (patch)
tree6136d4cb37fbff3f9fcbc4ca8e1b8e25c12f467c /src/include/storage/lwlock.h
parent570bd2b3fd20d3f8896f5e6a8133d6aed385ac86 (diff)
downloadpostgresql-7882c3b0b95640e361f1533fe0f2d02e4e5d8610.tar.gz
Convert the PGPROC->lwWaitLink list into a dlist instead of open coding it.
Besides being shorter and much easier to read it changes the logic in LWLockRelease() to release all shared lockers when waking up any. This can yield some significant performance improvements - and the fairness isn't really much worse than before, as we always allowed new shared lockers to jump the queue.
Diffstat (limited to 'src/include/storage/lwlock.h')
-rw-r--r--src/include/storage/lwlock.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h
index 09654a873e..c84970a7ad 100644
--- a/src/include/storage/lwlock.h
+++ b/src/include/storage/lwlock.h
@@ -14,6 +14,7 @@
#ifndef LWLOCK_H
#define LWLOCK_H
+#include "lib/ilist.h"
#include "storage/s_lock.h"
struct PGPROC;
@@ -50,9 +51,7 @@ typedef struct LWLock
char exclusive; /* # of exclusive holders (0 or 1) */
int shared; /* # of shared holders (0..MaxBackends) */
int tranche; /* tranche ID */
- struct PGPROC *head; /* head of list of waiting PGPROCs */
- struct PGPROC *tail; /* tail of list of waiting PGPROCs */
- /* tail is undefined when head is NULL */
+ dlist_head waiters; /* list of waiting PGPROCs */
} LWLock;
/*