Make HP-PA S_UNLOCK a little faster and less dependent on unspecified compiler codegen details.
Make default S_LOCK macro more robust against syntax mistakes. (I cleared these changes with David Gould a few days ago.)
This commit is contained in:
parent
0d1aa5ac52
commit
92edd4233e
@ -9,7 +9,7 @@
|
|||||||
#define HAS_TEST_AND_SET
|
#define HAS_TEST_AND_SET
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int sem[4];
|
int sema[4];
|
||||||
} slock_t;
|
} slock_t;
|
||||||
|
|
||||||
#ifndef BIG_ENDIAN
|
#ifndef BIG_ENDIAN
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.50 1998/09/21 02:25:27 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.51 1998/10/01 01:53:50 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -243,16 +243,20 @@ tas(slock_t *s_lock)
|
|||||||
* HP-UX (PA-RISC)
|
* HP-UX (PA-RISC)
|
||||||
*
|
*
|
||||||
* Note that slock_t on PA-RISC is a structure instead of char
|
* Note that slock_t on PA-RISC is a structure instead of char
|
||||||
* (see storage/ipc.h).
|
* (see include/port/hpux.h).
|
||||||
*
|
*
|
||||||
* a "set" slock_t has a single word cleared. a "clear" slock_t has
|
* a "set" slock_t has a single word cleared. a "clear" slock_t has
|
||||||
* all words set to non-zero. tas() in tas.s
|
* all words set to non-zero. tas() in tas.s
|
||||||
*/
|
*/
|
||||||
static const slock_t clear_lock =
|
|
||||||
{{-1, -1, -1, -1}};
|
|
||||||
|
|
||||||
#define S_UNLOCK(lock) (*(lock) = clear_lock) /* struct assignment */
|
#define S_UNLOCK(lock) \
|
||||||
|
{ \
|
||||||
|
volatile slock_t *lock_ = (volatile slock_t *) (lock); \
|
||||||
|
lock_->sema[0] = lock_->sema[1] = lock_->sema[2] = lock_->sema[3] = -1; \
|
||||||
|
}
|
||||||
|
|
||||||
#define S_LOCK_FREE(lock) ( *(int *) (((long) (lock) + 15) & ~15) != 0)
|
#define S_LOCK_FREE(lock) ( *(int *) (((long) (lock) + 15) & ~15) != 0)
|
||||||
|
|
||||||
#endif /* __hpux */
|
#endif /* __hpux */
|
||||||
|
|
||||||
|
|
||||||
@ -322,9 +326,10 @@ static const slock_t clear_lock =
|
|||||||
extern void s_lock(volatile slock_t *lock, const char *file, const int line);
|
extern void s_lock(volatile slock_t *lock, const char *file, const int line);
|
||||||
|
|
||||||
#define S_LOCK(lock) \
|
#define S_LOCK(lock) \
|
||||||
if (TAS((volatile slock_t *) lock)) {\
|
do { \
|
||||||
|
if (TAS((volatile slock_t *) lock)) \
|
||||||
s_lock((volatile slock_t *) lock, __FILE__, __LINE__); \
|
s_lock((volatile slock_t *) lock, __FILE__, __LINE__); \
|
||||||
} else
|
} while (0)
|
||||||
#endif /* S_LOCK */
|
#endif /* S_LOCK */
|
||||||
|
|
||||||
#if !defined(S_LOCK_FREE)
|
#if !defined(S_LOCK_FREE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user