diff options
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
-rw-r--r-- | src/backend/storage/lmgr/proc.c | 29 |
1 files changed, 18 insertions, 11 deletions
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)); |