-
+
User-Defined Functions
Optionally, a dynamically loaded file can contain initialization and
finalization functions. If the file includes a function named
- <literal>_PG_init>, that function will be called immediately after
+ <function>_PG_init>, that function will be called immediately after
loading the file. The function receives no parameters and should
return void. If the file includes a function named
- <literal>_PG_fini>, that function will be called immediately before
+ <function>_PG_fini>, that function will be called immediately before
unloading the file. Likewise, the function receives no parameters and
- should return void. Note that <literal>_PG_fini> will only be called
+ should return void. Note that <function>_PG_fini> will only be called
during an unload of the file, not during process termination.
(Presently, an unload only happens in the context of re-loading
the file due to an explicit LOAD> command.)
void RequestAddinShmemSpace(int size)
- from your <literal>_PG_init> function.
+ from your <function>_PG_init> function.
LWLocks are reserved by calling:
void RequestAddinLWLocks(int n)
- from <literal>_PG_init>.
+ from <function>_PG_init>.
To avoid possible race-conditions, each backend should use the LWLock
- <literal>AddinShmemInitLock> when connecting to and intializing
+ <function>AddinShmemInitLock> when connecting to and initializing
its allocation of shared memory, as shown here:
-
static mystruct *ptr = NULL;