diff options
author | Bruce Momjian <bruce@momjian.us> | 2000-04-12 17:17:23 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2000-04-12 17:17:23 +0000 |
commit | 52f77df613cea1803ce86321c37229626d9f213c (patch) | |
tree | bd9ac9f667f295cb65f4c448a5bb5a062d656b27 /src/backend/storage/lmgr | |
parent | db4518729d85da83eafdacbcebaeb12618517595 (diff) | |
download | postgresql-52f77df613cea1803ce86321c37229626d9f213c.tar.gz postgresql-52f77df613cea1803ce86321c37229626d9f213c.zip |
Ye-old pgindent run. Same 4-space tabs.
Diffstat (limited to 'src/backend/storage/lmgr')
-rw-r--r-- | src/backend/storage/lmgr/lmgr.c | 18 | ||||
-rw-r--r-- | src/backend/storage/lmgr/proc.c | 29 |
2 files changed, 27 insertions, 20 deletions
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c index 7152db297ea..44a74e8591f 100644 --- a/src/backend/storage/lmgr/lmgr.c +++ b/src/backend/storage/lmgr/lmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.38 2000/01/26 05:57:00 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.39 2000/04/12 17:15:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -145,14 +145,14 @@ LockRelation(Relation relation, LOCKMODE lockmode) tag.dbId = relation->rd_lockInfo.lockRelId.dbId; tag.objId.blkno = InvalidBlockNumber; - if (! LockAcquire(LockTableId, &tag, lockmode)) + if (!LockAcquire(LockTableId, &tag, lockmode)) elog(ERROR, "LockRelation: LockAcquire failed"); /* - * Check to see if the relcache entry has been invalidated - * while we were waiting to lock it. If so, rebuild it, - * or elog() trying. Increment the refcount to ensure that - * RelationFlushRelation will rebuild it and not just delete it. + * Check to see if the relcache entry has been invalidated while we + * were waiting to lock it. If so, rebuild it, or elog() trying. + * Increment the refcount to ensure that RelationFlushRelation will + * rebuild it and not just delete it. */ RelationIncrementReferenceCount(relation); DiscardInvalid(); @@ -194,7 +194,7 @@ LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode) tag.dbId = relation->rd_lockInfo.lockRelId.dbId; tag.objId.blkno = blkno; - if (! LockAcquire(LockTableId, &tag, lockmode)) + if (!LockAcquire(LockTableId, &tag, lockmode)) elog(ERROR, "LockPage: LockAcquire failed"); } @@ -230,7 +230,7 @@ XactLockTableInsert(TransactionId xid) tag.dbId = InvalidOid; tag.objId.xid = xid; - if (! LockAcquire(LockTableId, &tag, ExclusiveLock)) + if (!LockAcquire(LockTableId, &tag, ExclusiveLock)) elog(ERROR, "XactLockTableInsert: LockAcquire failed"); } @@ -263,7 +263,7 @@ XactLockTableWait(TransactionId xid) tag.dbId = InvalidOid; tag.objId.xid = xid; - if (! LockAcquire(LockTableId, &tag, ShareLock)) + if (!LockAcquire(LockTableId, &tag, ShareLock)) elog(ERROR, "XactLockTableWait: LockAcquire failed"); LockRelease(LockTableId, &tag, ShareLock); diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 82b40a333ce..de161517239 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.71 2000/04/10 00:45:42 inoue Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.72 2000/04/12 17:15:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,7 @@ * This is so that we can support more backends. (system-wide semaphore * sets run out pretty fast.) -ay 4/95 * - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.71 2000/04/10 00:45:42 inoue Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.72 2000/04/12 17:15:38 momjian Exp $ */ #include <sys/time.h> #include <unistd.h> @@ -72,7 +72,7 @@ #include "storage/proc.h" #include "utils/trace.h" -void HandleDeadLock(SIGNAL_ARGS); +void HandleDeadLock(SIGNAL_ARGS); static void ProcFreeAllSemaphores(void); static bool GetOffWaitqueue(PROC *); @@ -320,11 +320,13 @@ InitProcess(IPCKey key) static bool GetOffWaitqueue(PROC *proc) { - bool getoffed = false; + bool getoffed = false; + LockLockTable(); if (proc->links.next != INVALID_OFFSET) { - int lockmode = proc->token; + int lockmode = proc->token; + Assert(proc->waitLock->waitProcs.size > 0); SHMQueueDelete(&(proc->links)); --proc->waitLock->waitProcs.size; @@ -343,6 +345,7 @@ GetOffWaitqueue(PROC *proc) return getoffed; } + /* * ProcReleaseLocks() -- release all locks associated with this process * @@ -485,8 +488,9 @@ ProcQueueInit(PROC_QUEUE *queue) * Handling cancel request while waiting for lock * */ -static bool lockWaiting = false; -void SetWaitingForLock(bool waiting) +static bool lockWaiting = false; +void +SetWaitingForLock(bool waiting) { if (waiting == lockWaiting) return; @@ -499,7 +503,7 @@ void SetWaitingForLock(bool waiting) lockWaiting = false; return; } - if (QueryCancel) /* cancel request pending */ + if (QueryCancel) /* cancel request pending */ { if (GetOffWaitqueue(MyProc)) { @@ -509,11 +513,14 @@ void SetWaitingForLock(bool waiting) } } } -void LockWaitCancel(void) +void +LockWaitCancel(void) { - struct itimerval timeval, dummy; + struct itimerval timeval, + dummy; - if (!lockWaiting) return; + if (!lockWaiting) + return; lockWaiting = false; /* Deadlock timer off */ MemSet(&timeval, 0, sizeof(struct itimerval)); |