From 1d8bbfd2e7cfb72cbe4d5c5d4fa650a28dedac0b Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 19 Aug 1997 21:40:56 +0000 Subject: Make functions static where possible, enclose unused functions in #ifdef NOT_USED. --- src/backend/storage/ipc/spin.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/backend/storage/ipc/spin.c') diff --git a/src/backend/storage/ipc/spin.c b/src/backend/storage/ipc/spin.c index 4246b36b09..118a597ff8 100644 --- a/src/backend/storage/ipc/spin.c +++ b/src/backend/storage/ipc/spin.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.4 1997/01/14 01:53:11 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.5 1997/08/19 21:33:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -48,13 +48,6 @@ CreateSpinlocks(IPCKey key) return(TRUE); } -bool -AttachSpinLocks(IPCKey key) -{ - /* the spin lock shared memory must have been attached by now */ - return(TRUE); -} - bool InitSpinLocks(int init, IPCKey key) { @@ -100,16 +93,26 @@ SpinRelease(SPINLOCK lock) ExclusiveUnlock(lock); } -bool +#else /* HAS_TEST_AND_SET */ +/* Spinlocks are implemented using SysV semaphores */ + +static bool AttachSpinLocks(IPCKey key); +static bool SpinIsLocked(SPINLOCK lock); + + +static bool +AttachSpinLocks(IPCKey key) +{ + /* the spin lock shared memory must have been attached by now */ + return(TRUE); +} + +static bool SpinIsLocked(SPINLOCK lock) { return(!LockIsFree(lock)); } -#else /* HAS_TEST_AND_SET */ -/* Spinlocks are implemented using SysV semaphores */ - - /* * SpinAcquire -- try to grab a spinlock * @@ -135,7 +138,7 @@ SpinRelease(SPINLOCK lock) IpcSemaphoreUnlock(SpinLockId, lock, IpcExclusiveLock); } -bool +static bool SpinIsLocked(SPINLOCK lock) { int semval; @@ -176,7 +179,7 @@ CreateSpinlocks(IPCKey key) /* * Attach to existing spinlock set */ -bool +static bool AttachSpinLocks(IPCKey key) { IpcSemaphoreId id; -- cgit v1.2.1