diff options
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
-rw-r--r-- | src/backend/storage/lmgr/proc.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index c3ba6544216..597e97a5b0e 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.157 2005/04/15 04:18:10 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.158 2005/05/19 21:35:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -49,7 +49,7 @@ #include "storage/bufmgr.h" #include "storage/ipc.h" #include "storage/proc.h" -#include "storage/sinval.h" +#include "storage/procarray.h" #include "storage/spin.h" @@ -116,8 +116,7 @@ ProcGlobalSemas(int maxBackends) /* * InitProcGlobal - - * initializes the global process table. We put it here so that - * the postmaster can do this initialization. + * Initialize the global process table during postmaster startup. * * We also create all the per-process semaphores we will need to support * the requested number of backends. We used to allocate semaphores @@ -264,6 +263,11 @@ InitProcess(void) SHMQueueInit(&(MyProc->procLocks)); /* + * Add our PGPROC to the PGPROC array in shared memory. + */ + ProcArrayAddMyself(); + + /* * Arrange to clean up at backend exit. */ on_shmem_exit(ProcKill, 0); @@ -473,6 +477,9 @@ ProcKill(int code, Datum arg) LockReleaseAll(USER_LOCKMETHOD, true); #endif + /* Remove our PGPROC from the PGPROC array in shared memory */ + ProcArrayRemoveMyself(); + SpinLockAcquire(ProcStructLock); /* Return PGPROC structure (and semaphore) to freelist */ @@ -978,12 +985,12 @@ ProcCancelWaitForSignal(void) } /* - * ProcSendSignal - send a signal to a backend identified by BackendId + * ProcSendSignal - send a signal to a backend identified by PID */ void -ProcSendSignal(BackendId procId) +ProcSendSignal(int pid) { - PGPROC *proc = BackendIdGetProc(procId); + PGPROC *proc = BackendPidGetProc(pid); if (proc != NULL) PGSemaphoreUnlock(&proc->sem); |