aboutsummaryrefslogtreecommitdiff
path: root/src/include/postmaster/bgworker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/postmaster/bgworker.h')
-rw-r--r--src/include/postmaster/bgworker.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/include/postmaster/bgworker.h b/src/include/postmaster/bgworker.h
index 53167057e9a..794eb390725 100644
--- a/src/include/postmaster/bgworker.h
+++ b/src/include/postmaster/bgworker.h
@@ -52,7 +52,7 @@
#define BGWORKER_BACKEND_DATABASE_CONNECTION 0x0002
-typedef void (*bgworker_main_type) (void *main_arg);
+typedef void (*bgworker_main_type) (Datum main_arg);
typedef void (*bgworker_sighdlr_type) (SIGNAL_ARGS);
/*
@@ -67,22 +67,28 @@ typedef enum
#define BGW_DEFAULT_RESTART_INTERVAL 60
#define BGW_NEVER_RESTART -1
+#define BGW_MAXLEN 64
typedef struct BackgroundWorker
{
- char *bgw_name;
+ char bgw_name[BGW_MAXLEN];
int bgw_flags;
BgWorkerStartTime bgw_start_time;
int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */
bgworker_main_type bgw_main;
- void *bgw_main_arg;
+ char bgw_library_name[BGW_MAXLEN]; /* only if bgw_main is NULL */
+ char bgw_function_name[BGW_MAXLEN]; /* only if bgw_main is NULL */
+ Datum bgw_main_arg;
bgworker_sighdlr_type bgw_sighup;
bgworker_sighdlr_type bgw_sigterm;
} BackgroundWorker;
-/* Register a new bgworker */
+/* Register a new bgworker during shared_preload_libraries */
extern void RegisterBackgroundWorker(BackgroundWorker *worker);
+/* Register a new bgworker from a regular backend */
+extern bool RegisterDynamicBackgroundWorker(BackgroundWorker *worker);
+
/* This is valid in a running worker */
extern BackgroundWorker *MyBgworkerEntry;