mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Use dlist/dclist instead of PROC_QUEUE / SHM_QUEUE for heavyweight locks
Part of a series to remove SHM_QUEUE. ilist.h style lists are more widely used and have an easier to use interface. As PROC_QUEUE is now unused, remove it. Reviewed-by: Thomas Munro <thomas.munro@gmail.com> (in an older version) Discussion: https://postgr.es/m/20221120055930.t6kl3tyivzhlrzu2@awork3.anarazel.de Discussion: https://postgr.es/m/20200211042229.msv23badgqljrdg2@alap3.anarazel.de
This commit is contained in:
@@ -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) \
|
||||
|
||||
Reference in New Issue
Block a user