-
-
Save qpfiffer/5bb503264b903a29a191 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// Makefile | |
MODULES = pg_webrtc | |
PG_CONFIG = pg_config | |
#PG_CPPFLAGS = -fPIC | |
PGXS := $(shell $(PG_CONFIG) --pgxs) | |
include $(PGXS) | |
//// pg_webrtc.h | |
#include "postgres.h" | |
#include "postmaster/bgworker.h" | |
#include "storage/ipc.h" | |
#include "storage/latch.h" | |
#include "storage/proc.h" | |
#include "fmgr.h" | |
PG_MODULE_MAGIC; | |
void _PG_init(); | |
void pg_webrtc_main(Datum main_arg); | |
//// pg_webrtc.cpp | |
#include "pg_webrtc.h" | |
void pg_webrtc_main(Datum main_arg) { | |
BackgroundWorkerUnblockSignals(); | |
} | |
void _PG_init() { | |
BackgroundWorker worker; | |
worker.bgw_flags = BGWORKER_SHMEM_ACCESS; | |
worker.bgw_main = pg_webrtc_main; | |
worker.bgw_restart_time = 1; | |
worker.bgw_start_time = BgWorkerStart_RecoveryFinished; | |
snprintf(worker.bgw_name, BGW_MAXLEN, "pg_webrtc"); | |
RegisterBackgroundWorker(&worker); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment