19#include "storage/shmem.h"
25#if (PG_VERSION_NUM >= 150000)
26shmem_request_hook_type prev_shmem_request = NULL;
43 LWLockAcquire(AddinShmemInitLock, LW_EXCLUSIVE);
54 LWLockRelease(AddinShmemInitLock);
60 if(pipe(pipes_b_to_m) || pipe(pipes_m_to_b))
61 provsql_error(
"Cannot create pipe to communicate with MMap worker");
76#if (PG_VERSION_NUM >= 150000)
77 if (prev_shmem_request)
83 RequestNamedLWLockTranche(
"provsql", 1);
#define provsql_error(fmt,...)
Report a fatal ProvSQL error and abort the current transaction.
Background worker and IPC primitives for mmap-backed circuit storage.
void provsql_shmem_unlock(void)
Release the ProvSQL LWLock.
void provsql_shmem_lock_exclusive(void)
Acquire the ProvSQL LWLock in exclusive mode.
provsqlSharedState * provsql_shared_state
Pointer to the ProvSQL shared-memory segment (set in provsql_shmem_startup).
void provsql_shmem_request(void)
Request shared memory from PostgreSQL (PG ≥ 15).
shmem_startup_hook_type prev_shmem_startup
Saved pointer to the previous shmem_startup_hook, for chaining.
void provsql_shmem_startup(void)
Initialise the ProvSQL shared-memory segment.
Size provsql_memsize(void)
Return the number of bytes required for the shared-memory segment.
void provsql_shmem_lock_shared(void)
Acquire the ProvSQL LWLock in shared mode.
Shared-memory segment and inter-process pipe management.
Shared state stored in the PostgreSQL shared-memory segment.
long pipebmr
Background-to-main pipe: read end (worker reads)
LWLock * lock
Mutual-exclusion lock for pipe writes.
long pipembr
Main-to-background pipe: read end (worker reads)
long pipebmw
Background-to-main pipe: write end (worker writes)
long pipembw
Main-to-background pipe: write end (backend writes)