77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.6 1997/09/24 23:37:26 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.7 1997/09/25 01:48:58 momjian Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
5555
5656#define S_INIT_LOCK (lock )mutex_init(lock)
5757
58- #define S_LOCK_FREE (lock )((*lock) == 0)
59-
6058/* S_LOCK_FREE should return 1 if lock is free; 0 if lock is locked */
6159/* For Mach, we have to delve inside the entrails of `struct mutex'. Ick! */
6260#define S_LOCK_FREE (alock )((alock)->lock == 0)
@@ -135,8 +133,6 @@ static inttas(slock_t *lock);
135133
136134#define S_INIT_LOCK (lock )S_UNLOCK(lock)
137135
138- #define S_LOCK_FREE (lock )((*lock) == 0)
139-
140136#endif /* i86pc_solaris || sparc_solaris */
141137
142138/*
@@ -158,8 +154,6 @@ static inttas(slock_t *lock);
158154
159155#define S_INIT_LOCK (lock )S_UNLOCK(lock)
160156
161- #define S_LOCK_FREE (lock )((*lock) == 0)
162-
163157#endif /* aix */
164158
165159/*
@@ -211,8 +205,6 @@ static inttas(slock_t *lock);
211205
212206#define S_INIT_LOCK (lock )S_UNLOCK(lock)
213207
214- #define S_LOCK_FREE (lock )((*lock) == 0)
215-
216208static int
217209tas_dummy ()
218210{
@@ -295,8 +287,6 @@ tas_dummy()
295287
296288#define S_INIT_LOCK (addr )(*(addr) = 0)
297289
298- #define S_LOCK_FREE (lock )((*lock) == 0)
299-
300290#endif /* NEED_SPARC_TAS_ASM */
301291
302292/*
@@ -318,8 +308,6 @@ tas_dummy()
318308
319309#define S_INIT_LOCK (lock )S_UNLOCK(lock)
320310
321- #define S_LOCK_FREE (lock )((*lock) == 0)
322-
323311#endif /* NEED_I386_TAS_ASM */
324312
325313
@@ -351,8 +339,6 @@ tas_dummy()
351339
352340#define S_INIT_LOCK (lock )S_UNLOCK(lock)
353341
354- #define S_LOCK_FREE (lock )((*lock) == 0)
355-
356342#endif /* defined(__alpha__) && defined(linux) */
357343
358344#if defined(linux )&& defined(sparc )
@@ -372,8 +358,6 @@ tas_dummy()
372358
373359#define S_INIT_LOCK (lock )S_UNLOCK(lock)
374360
375- #define S_LOCK_FREE (lock )((*lock) == 0)
376-
377361#endif /* defined(linux) && defined(sparc) */
378362
379363#if defined(linux )&& defined(PPC )
@@ -407,10 +391,12 @@ success:\n\
407391
408392#define S_INIT_LOCK (lock )S_UNLOCK(lock)
409393
410- #define S_LOCK_FREE (lock )((*lock) == 0)
411-
412394#endif /* defined(linux) && defined(PPC) */
413395
396+ #ifndef S_LOCK_FREE /* for those who have not already defined it */
397+ #define S_LOCK_FREE (lock )((*lock) == 0)
398+ #endif
399+
414400#endif /* HAS_TEST_AND_SET */
415401
416402#endif /* S_LOCK_H */