77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.5 1997/09/22 18:14:25 momjian Exp $
10+ * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.6 1997/09/24 23:37:26 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+
5860/* S_LOCK_FREE should return 1 if lock is free; 0 if lock is locked */
5961/* For Mach, we have to delve inside the entrails of `struct mutex'. Ick! */
6062#define S_LOCK_FREE (alock )((alock)->lock == 0)
@@ -133,6 +135,8 @@ static inttas(slock_t *lock);
133135
134136#define S_INIT_LOCK (lock )S_UNLOCK(lock)
135137
138+ #define S_LOCK_FREE (lock )((*lock) == 0)
139+
136140#endif /* i86pc_solaris || sparc_solaris */
137141
138142/*
@@ -154,6 +158,8 @@ static inttas(slock_t *lock);
154158
155159#define S_INIT_LOCK (lock )S_UNLOCK(lock)
156160
161+ #define S_LOCK_FREE (lock )((*lock) == 0)
162+
157163#endif /* aix */
158164
159165/*
@@ -205,6 +211,8 @@ static inttas(slock_t *lock);
205211
206212#define S_INIT_LOCK (lock )S_UNLOCK(lock)
207213
214+ #define S_LOCK_FREE (lock )((*lock) == 0)
215+
208216static int
209217tas_dummy ()
210218{
@@ -287,6 +295,8 @@ tas_dummy()
287295
288296#define S_INIT_LOCK (addr )(*(addr) = 0)
289297
298+ #define S_LOCK_FREE (lock )((*lock) == 0)
299+
290300#endif /* NEED_SPARC_TAS_ASM */
291301
292302/*
@@ -308,6 +318,8 @@ tas_dummy()
308318
309319#define S_INIT_LOCK (lock )S_UNLOCK(lock)
310320
321+ #define S_LOCK_FREE (lock )((*lock) == 0)
322+
311323#endif /* NEED_I386_TAS_ASM */
312324
313325
@@ -339,6 +351,8 @@ tas_dummy()
339351
340352#define S_INIT_LOCK (lock )S_UNLOCK(lock)
341353
354+ #define S_LOCK_FREE (lock )((*lock) == 0)
355+
342356#endif /* defined(__alpha__) && defined(linux) */
343357
344358#if defined(linux )&& defined(sparc )
@@ -358,6 +372,8 @@ tas_dummy()
358372
359373#define S_INIT_LOCK (lock )S_UNLOCK(lock)
360374
375+ #define S_LOCK_FREE (lock )((*lock) == 0)
376+
361377#endif /* defined(linux) && defined(sparc) */
362378
363379#if defined(linux )&& defined(PPC )
@@ -391,12 +407,10 @@ success:\n\
391407
392408#define S_INIT_LOCK (lock )S_UNLOCK(lock)
393409
394- #endif /* defined(linux) && defined(PPC) */
395-
396- #else /* HAS_TEST_AND_SET */
397-
398410#define S_LOCK_FREE (lock )((*lock) == 0)
399411
412+ #endif /* defined(linux) && defined(PPC) */
413+
400414#endif /* HAS_TEST_AND_SET */
401415
402416#endif /* S_LOCK_H */