diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/pg_config_manual.h | 5 | ||||
| -rw-r--r-- | src/include/storage/lwlock.h | 22 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index 383809bf5d8..ef895211da5 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -52,11 +52,6 @@ #define SEQ_MINVALUE (-SEQ_MAXVALUE) /* - * Number of spare LWLocks to allocate for user-defined add-on code. - */ -#define NUM_USER_DEFINED_LWLOCKS 4 - -/* * When we don't have native spinlocks, we use semaphores to simulate them. * Decreasing this value reduces consumption of OS resources; increasing it * may improve performance, but supplying a real spinlock implementation is diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index 613df19ad64..b2bdbbaf1b9 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -119,6 +119,16 @@ typedef union LWLockMinimallyPadded extern PGDLLIMPORT LWLockPadded *MainLWLockArray; extern char *MainLWLockNames[]; +/* struct for storing named tranche information */ +typedef struct NamedLWLockTranche +{ + LWLockTranche lwLockTranche; + int trancheId; +} NamedLWLockTranche; + +extern PGDLLIMPORT NamedLWLockTranche *NamedLWLockTrancheArray; +extern PGDLLIMPORT int NamedLWLockTrancheRequests; + /* Names for fixed lwlocks */ #include "storage/lwlocknames.h" @@ -178,12 +188,14 @@ extern void CreateLWLocks(void); extern void InitLWLockAccess(void); /* - * The traditional method for obtaining an lwlock for use by an extension is - * to call RequestAddinLWLocks() during postmaster startup; this will reserve - * space for the indicated number of locks in MainLWLockArray. Subsequently, - * a lock can be allocated using LWLockAssign. + * Extensions (or core code) can obtain an LWLocks by calling + * RequestNamedLWLockTranche() during postmaster startup. Subsequently, + * call GetNamedLWLockTranche() and to obtain a pointer to an array + * containing the number of LWLocks requested. */ -extern void RequestAddinLWLocks(int n); +extern void RequestNamedLWLockTranche(const char *tranche_name, int num_lwlocks); +extern LWLockPadded *GetNamedLWLockTranche(const char *tranche_name); + extern LWLock *LWLockAssign(void); /* |
