1/*-------------------------------------------------------------------------
2 *
3 * async.h
4 * Asynchronous notification: NOTIFY, LISTEN, UNLISTEN
5 *
6 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * src/include/commands/async.h
10 *
11 *-------------------------------------------------------------------------
12 */
13#ifndef ASYNC_H
14#define ASYNC_H
15
16#include <signal.h>
17
18#include "fmgr.h"
19
20/*
21 * The number of SLRU page buffers we use for the notification queue.
22 */
23#define NUM_ASYNC_BUFFERS 8
24
25extern bool Trace_notify;
26extern volatile sig_atomic_t notifyInterruptPending;
27
28extern Size AsyncShmemSize(void);
29extern void AsyncShmemInit(void);
30
31extern void NotifyMyFrontEnd(const char *channel,
32 const char *payload,
33 int32 srcPid);
34
35/* notify-related SQL statements */
36extern void Async_Notify(const char *channel, const char *payload);
37extern void Async_Listen(const char *channel);
38extern void Async_Unlisten(const char *channel);
39extern void Async_UnlistenAll(void);
40
41/* perform (or cancel) outbound notify processing at transaction commit */
42extern void PreCommit_Notify(void);
43extern void AtCommit_Notify(void);
44extern void AtAbort_Notify(void);
45extern void AtSubStart_Notify(void);
46extern void AtSubCommit_Notify(void);
47extern void AtSubAbort_Notify(void);
48extern void AtPrepare_Notify(void);
49extern void ProcessCompletedNotifies(void);
50
51/* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */
52extern void HandleNotifyInterrupt(void);
53
54/* process interrupts */
55extern void ProcessNotifyInterrupt(void);
56
57#endif /* ASYNC_H */
58