mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Complete TODO item:
* -HOLDER/HOLDERTAB rename to PROCLOCK/PROCLOCKTAG
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: lock.h,v 1.62 2002/07/18 23:06:20 momjian Exp $
|
||||
* $Id: lock.h,v 1.63 2002/07/19 00:17:40 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -130,7 +130,7 @@ typedef struct LOCKTAG
|
||||
* tag -- uniquely identifies the object being locked
|
||||
* grantMask -- bitmask for all lock types currently granted on this object.
|
||||
* waitMask -- bitmask for all lock types currently awaited on this object.
|
||||
* lockHolders -- list of HOLDER objects for this lock.
|
||||
* lockHolders -- list of PROCLOCK objects for this lock.
|
||||
* waitProcs -- queue of processes waiting for this lock.
|
||||
* requested -- count of each lock type currently requested on the lock
|
||||
* (includes requests already granted!!).
|
||||
@@ -146,7 +146,7 @@ typedef struct LOCK
|
||||
/* data */
|
||||
int grantMask; /* bitmask for lock types already granted */
|
||||
int waitMask; /* bitmask for lock types awaited */
|
||||
SHM_QUEUE lockHolders; /* list of HOLDER objects assoc. with lock */
|
||||
SHM_QUEUE lockHolders; /* list of PROCLOCK objects assoc. with lock */
|
||||
PROC_QUEUE waitProcs; /* list of PGPROC objects waiting on lock */
|
||||
int requested[MAX_LOCKMODES]; /* counts of requested
|
||||
* locks */
|
||||
@@ -163,8 +163,8 @@ typedef struct LOCK
|
||||
* on the same lockable object. We need to store some per-holder information
|
||||
* for each such holder (or would-be holder).
|
||||
*
|
||||
* HOLDERTAG is the key information needed to look up a HOLDER item in the
|
||||
* holder hashtable. A HOLDERTAG value uniquely identifies a lock holder.
|
||||
* PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the
|
||||
* holder hashtable. A PROCLOCKTAG value uniquely identifies a lock holder.
|
||||
*
|
||||
* There are two possible kinds of holder tags: a transaction (identified
|
||||
* both by the PGPROC of the backend running it, and the xact's own ID) and
|
||||
@@ -180,32 +180,32 @@ typedef struct LOCK
|
||||
* Otherwise, holder objects whose counts have gone to zero are recycled
|
||||
* as soon as convenient.
|
||||
*
|
||||
* Each HOLDER object is linked into lists for both the associated LOCK object
|
||||
* and the owning PGPROC object. Note that the HOLDER is entered into these
|
||||
* Each PROCLOCK object is linked into lists for both the associated LOCK object
|
||||
* and the owning PGPROC object. Note that the PROCLOCK is entered into these
|
||||
* lists as soon as it is created, even if no lock has yet been granted.
|
||||
* A PGPROC that is waiting for a lock to be granted will also be linked into
|
||||
* the lock's waitProcs queue.
|
||||
*/
|
||||
typedef struct HOLDERTAG
|
||||
typedef struct PROCLOCKTAG
|
||||
{
|
||||
SHMEM_OFFSET lock; /* link to per-lockable-object information */
|
||||
SHMEM_OFFSET proc; /* link to PGPROC of owning backend */
|
||||
TransactionId xid; /* xact ID, or InvalidTransactionId */
|
||||
} HOLDERTAG;
|
||||
} PROCLOCKTAG;
|
||||
|
||||
typedef struct HOLDER
|
||||
typedef struct PROCLOCK
|
||||
{
|
||||
/* tag */
|
||||
HOLDERTAG tag; /* unique identifier of holder object */
|
||||
PROCLOCKTAG tag; /* unique identifier of holder object */
|
||||
|
||||
/* data */
|
||||
int holding[MAX_LOCKMODES]; /* count of locks currently held */
|
||||
int nHolding; /* total of holding[] array */
|
||||
SHM_QUEUE lockLink; /* list link for lock's list of holders */
|
||||
SHM_QUEUE procLink; /* list link for process's list of holders */
|
||||
} HOLDER;
|
||||
} PROCLOCK;
|
||||
|
||||
#define HOLDER_LOCKMETHOD(holder) \
|
||||
#define PROCLOCK_LOCKMETHOD(holder) \
|
||||
(((LOCK *) MAKE_PTR((holder).tag.lock))->tag.lockmethod)
|
||||
|
||||
|
||||
@@ -225,9 +225,9 @@ extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
|
||||
bool allxids, TransactionId xid);
|
||||
extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
|
||||
LOCKMODE lockmode,
|
||||
LOCK *lock, HOLDER *holder, PGPROC *proc,
|
||||
LOCK *lock, PROCLOCK *holder, PGPROC *proc,
|
||||
int *myHolding);
|
||||
extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode);
|
||||
extern void GrantLock(LOCK *lock, PROCLOCK *holder, LOCKMODE lockmode);
|
||||
extern void RemoveFromWaitQueue(PGPROC *proc);
|
||||
extern int LockShmemSize(int maxBackends);
|
||||
extern bool DeadLockCheck(PGPROC *proc);
|
||||
|
||||
Reference in New Issue
Block a user