Commit 85f75551 authored by Bruce Momjian's avatar Bruce Momjian

Small lock cleanup for prototype.

parent 5fb82eb4
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: ipc.h,v 1.21 1997/09/18 14:20:54 momjian Exp $ * $Id: ipc.h,v 1.22 1997/09/22 15:49:11 momjian Exp $
* *
* NOTES * NOTES
* This file is very architecture-specific. This stuff should actually * This file is very architecture-specific. This stuff should actually
...@@ -26,20 +26,6 @@ ...@@ -26,20 +26,6 @@
#include <config.h> #include <config.h>
#if defined(HAS_TEST_AND_SET)
#if (defined(alpha) && !defined(linuxalpha)) || \
defined(hpux) || \
defined(irix5) || \
defined(nextstep)
extern int S_LOCK_FREE(slock_t *lock);
#else
#define S_LOCK_FREE(lock) ((*lock) == 0)
#endif
#endif /* HAS_TEST_AND_SET */
#ifndef HAVE_UNION_SEMUN #ifndef HAVE_UNION_SEMUN
union semun union semun
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.2 1997/09/22 04:21:51 vadim Exp $ * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.3 1997/09/22 15:49:14 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -301,11 +301,11 @@ tas_dummy() ...@@ -301,11 +301,11 @@ tas_dummy()
#define S_LOCK(lock) do \ #define S_LOCK(lock) do \
{ \ { \
slock_t res; \ slock_t _res; \
do \ do \
{ \ { \
__asm__("xchgb %0,%1": "=q"(res), "=m"(*lock):"0"(0x1)); \ __asm__("xchgb %0,%1": "=q"(_res), "=m"(*lock):"0"(0x1)); \
} while (res != 0); \ } while (_res != 0); \
} while (0) } while (0)
#define S_UNLOCK(lock) (*(lock) = 0) #define S_UNLOCK(lock) (*(lock) = 0)
...@@ -319,7 +319,7 @@ tas_dummy() ...@@ -319,7 +319,7 @@ tas_dummy()
#define S_LOCK(lock) do \ #define S_LOCK(lock) do \
{ \ { \
slock_t res; \ slock_t _res; \
do \ do \
{ \ { \
__asm__(" ldq $0, %0 \n\ __asm__(" ldq $0, %0 \n\
...@@ -334,8 +334,8 @@ tas_dummy() ...@@ -334,8 +334,8 @@ tas_dummy()
jmp $31, end \n\ jmp $31, end \n\
stqc_fail: or $31, 1, $0 \n\ stqc_fail: or $31, 1, $0 \n\
already_set: bis $0, $0, %1 \n\ already_set: bis $0, $0, %1 \n\
end: nop ": "=m"(*lock), "=r"(res): :"0"); \ end: nop ": "=m"(*lock), "=r"(_res): :"0"); \
} while (res != 0); \ } while (_res != 0); \
} while (0) } while (0)
...@@ -349,13 +349,13 @@ tas_dummy() ...@@ -349,13 +349,13 @@ tas_dummy()
#define S_LOCK(lock) do \ #define S_LOCK(lock) do \
{ \ { \
slock_t res; \ slock_t _res; \
do \ do \
{ \ { \
__asm__("ldstub [%1], %0" \ __asm__("ldstub [%1], %0" \
: "=&r"(res) \ : "=&r"(_res) \
: "r"(lock)); \ : "r"(lock)); \
} while (!res != 0); \ } while (!_res != 0); \
} while (0) } while (0)
#define S_UNLOCK(lock) (*(lock) = 0) #define S_UNLOCK(lock) (*(lock) = 0)
...@@ -399,6 +399,10 @@ success: \n\ ...@@ -399,6 +399,10 @@ success: \n\
#endif /* defined(linux) && defined(PPC) */ #endif /* defined(linux) && defined(PPC) */
#else /* HAS_TEST_AND_SET */
#define S_LOCK_FREE(lock) ((*lock) == 0)
#endif /* HAS_TEST_AND_SET */ #endif /* HAS_TEST_AND_SET */
#endif /* S_LOCK_H */ #endif /* S_LOCK_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment