shmem_request_hook

请求额外共享内存的钩子

shmem_request_hook 是一个用于加载到内存中的钩子,用于请求额外共享内存的扩展

shmem_request_hookPostgreSQL 15 中添加。

更改历史

示例

shmem_request_hook 的使用示例

/*
 * Module load callback
 */
void
_PG_init(void)
{
        if (!process_shared_preload_libraries_in_progress)
                return;

	/*
         * Install hooks.
         */
#if (PG_VERSION_NUM >= 150000)
        prev_shmem_request_hook = shmem_request_hook;
        shmem_request_hook = extension_shmem_request;
#endif

        prev_shmem_startup_hook = shmem_startup_hook;
        shmem_startup_hook = extension_shmem_startup;

        /* ... */
}

#if (PG_VERSION_NUM >= 150000)
/*
 * shmem_requst_hook: request shared memory
 */
static void
extension_shmem_request(void)
{
        if (prev_shmem_request_hook)
                prev_shmem_request_hook();

        RequestAddinShmemSpace(MAXALIGN(sizeof(extensionSharedState)));

        RequestNamedLWLockTranche(TRANCHE_NAME, 1);
}
#endif

分类

扩展钩子内存

反馈

提交关于 "shmem_request_hook" 的任何评论、建议或更正 此处