clarify-S_LOCK-vs-TAS.patch
text/x-diff
Filename: clarify-S_LOCK-vs-TAS.patch
Type: text/x-diff
Part: 0
Message:
Re: small cleanup for s_lock.h
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/include/storage/s_lock.h | 7 | 13 |
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index c9e52511990..0a13c958fc8 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -652,19 +652,18 @@ spin_delay(void) #endif /* !defined(HAS_TEST_AND_SET) */ -/* Blow up if we didn't have any way to do spinlocks */ -#ifndef HAS_TEST_AND_SET -#error PostgreSQL does not have spinlock support on this platform. Please report this to pgsql-bugs@lists.postgresql.org. -#endif - - /* * Default Definitions - override these above as needed. */ #if !defined(S_LOCK) +#if defined(TAS) #define S_LOCK(lock) \ (TAS(lock) ? s_lock((lock), __FILE__, __LINE__, __func__) : 0) +#else +/* Must provide S_LOCK, or a TAS macro to base it on */ +#error PostgreSQL does not have spinlock support on this platform. Please report this to pgsql-bugs@lists.postgresql.org. +#endif /* TAS */ #endif /* S_LOCK */ #if !defined(S_UNLOCK) @@ -697,15 +696,10 @@ extern void s_unlock(volatile slock_t *lock); #define SPIN_DELAY() ((void) 0) #endif /* SPIN_DELAY */ -#if !defined(TAS) -extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or - * s_lock.c */ - -#define TAS(lock) tas(lock) -#endif /* TAS */ - #if !defined(TAS_SPIN) +#if defined(TAS) #define TAS_SPIN(lock) TAS(lock) +#endif /* TAS */ #endif /* TAS_SPIN */