*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.19 1999/02/19 06:06:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.20 1999/02/19 07:10:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* ----------------
*/
InitProcGlobal(key, maxBackends);
- on_shmem_exit(ProcFreeAllSemaphores, NULL);
CreateSharedInvalidationState(key);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.49 1999/02/19 06:06:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.50 1999/02/19 07:10:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* 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.49 1999/02/19 06:06:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.50 1999/02/19 07:10:48 tgl Exp $
*/
#include <sys/time.h>
#include <unistd.h>
static void HandleDeadLock(int sig);
static PROC *ProcWakeup(PROC *proc, int errType);
+static void ProcFreeAllSemaphores(void);
#define DeadlockCheckTimer pg_options[OPT_DEADLOCKTIMEOUT]
/* --------------------
* We're the first - initialize.
+ * XXX if found should ever be true, it is a sign of impending doom ...
+ * ought to complain if so?
* --------------------
*/
if (!found)
ProcGlobal->currKey = IPCGetProcessSemaphoreInitKey(key);
for (i = 0; i < MAX_PROC_SEMS / PROC_NSEMS_PER_SET; i++)
ProcGlobal->freeSemMap[i] = 0;
+
+ /* Arrange to delete semas on exit --- set this up now so that
+ * we will clean up if pre-allocation fails...
+ */
+ on_shmem_exit(ProcFreeAllSemaphores, NULL);
+
/* Pre-create the semaphores for the first maxBackends processes */
for (i = 0;
i < (maxBackends+PROC_NSEMS_PER_SET-1) / PROC_NSEMS_PER_SET;
* destroying shared state for a failed set of backends.
* Free up all the semaphores allocated to the lmgrs of the backends.
*/
-void
+static void
ProcFreeAllSemaphores()
{
int i;
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: proc.h,v 1.19 1999/02/19 06:06:37 tgl Exp $
+ * $Id: proc.h,v 1.20 1999/02/19 07:10:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
LOCK *lock);
extern void ProcAddLock(SHM_QUEUE *elem);
extern void ProcReleaseSpins(PROC *proc);
-extern void ProcFreeAllSemaphores(void);
#endif /* PROC_H */