summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/storage/lock.h15
-rw-r--r--src/include/storage/proc.h17
2 files changed, 13 insertions, 19 deletions
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 190bddb767c..6ae434596ad 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -18,6 +18,7 @@
#error "lock.h may not be included from frontend code"
#endif
+#include "lib/ilist.h"
#include "storage/backendid.h"
#include "storage/lockdefs.h"
#include "storage/lwlock.h"
@@ -27,12 +28,6 @@
/* struct PGPROC is declared in proc.h, but must forward-reference it */
typedef struct PGPROC PGPROC;
-typedef struct PROC_QUEUE
-{
- SHM_QUEUE links; /* head of list of PGPROC objects */
- int size; /* number of entries in list */
-} PROC_QUEUE;
-
/* GUC variables */
extern PGDLLIMPORT int max_locks_per_xact;
@@ -318,8 +313,8 @@ typedef struct LOCK
/* data */
LOCKMASK grantMask; /* bitmask for lock types already granted */
LOCKMASK waitMask; /* bitmask for lock types awaited */
- SHM_QUEUE procLocks; /* list of PROCLOCK objects assoc. with lock */
- PROC_QUEUE waitProcs; /* list of PGPROC objects waiting on lock */
+ dlist_head procLocks; /* list of PROCLOCK objects assoc. with lock */
+ dclist_head waitProcs; /* list of PGPROC objects waiting on lock */
int requested[MAX_LOCKMODES]; /* counts of requested locks */
int nRequested; /* total of requested[] array */
int granted[MAX_LOCKMODES]; /* counts of granted locks */
@@ -380,8 +375,8 @@ typedef struct PROCLOCK
PGPROC *groupLeader; /* proc's lock group leader, or proc itself */
LOCKMASK holdMask; /* bitmask for lock types currently held */
LOCKMASK releaseMask; /* bitmask for lock types to be released */
- SHM_QUEUE lockLink; /* list link in LOCK's list of proclocks */
- SHM_QUEUE procLink; /* list link in PGPROC's list of proclocks */
+ dlist_node lockLink; /* list link in LOCK's list of proclocks */
+ dlist_node procLink; /* list link in PGPROC's list of proclocks */
} PROCLOCK;
#define PROCLOCK_LOCKMETHOD(proclock) \
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index b5c6f46d031..6eb46a7ee8e 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -167,8 +167,8 @@ typedef enum
struct PGPROC
{
/* proc->links MUST BE FIRST IN STRUCT (see ProcSleep,ProcWakeup,etc) */
- SHM_QUEUE links; /* list link if process is in a list */
- PGPROC **procgloballist; /* procglobal list that owns this PGPROC */
+ dlist_node links; /* list link if process is in a list */
+ dlist_head *procgloballist; /* procglobal list that owns this PGPROC */
PGSemaphore sem; /* ONE semaphore to sleep on */
ProcWaitStatus waitStatus;
@@ -255,7 +255,7 @@ struct PGPROC
* linked into one of these lists, according to the partition number of
* their lock.
*/
- SHM_QUEUE myProcLocks[NUM_LOCK_PARTITIONS];
+ dlist_head myProcLocks[NUM_LOCK_PARTITIONS];
XidCacheStatus subxidStatus; /* mirrored with
* ProcGlobal->subxidStates[i] */
@@ -385,13 +385,13 @@ typedef struct PROC_HDR
/* Length of allProcs array */
uint32 allProcCount;
/* Head of list of free PGPROC structures */
- PGPROC *freeProcs;
+ dlist_head freeProcs;
/* Head of list of autovacuum's free PGPROC structures */
- PGPROC *autovacFreeProcs;
+ dlist_head autovacFreeProcs;
/* Head of list of bgworker free PGPROC structures */
- PGPROC *bgworkerFreeProcs;
+ dlist_head bgworkerFreeProcs;
/* Head of list of walsender free PGPROC structures */
- PGPROC *walsenderFreeProcs;
+ dlist_head walsenderFreeProcs;
/* First pgproc waiting for group XID clear */
pg_atomic_uint32 procArrayGroupFirst;
/* First pgproc waiting for group transaction status update */
@@ -448,9 +448,8 @@ extern int GetStartupBufferPinWaitBufId(void);
extern bool HaveNFreeProcs(int n);
extern void ProcReleaseLocks(bool isCommit);
-extern void ProcQueueInit(PROC_QUEUE *queue);
extern ProcWaitStatus ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable);
-extern PGPROC *ProcWakeup(PGPROC *proc, ProcWaitStatus waitStatus);
+extern void ProcWakeup(PGPROC *proc, ProcWaitStatus waitStatus);
extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock);
extern void CheckDeadLockAlert(void);
extern bool IsWaitingForLock(void);