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 | |
25 | extern bool Trace_notify; |
26 | extern volatile sig_atomic_t notifyInterruptPending; |
27 | |
28 | extern Size AsyncShmemSize(void); |
29 | extern void AsyncShmemInit(void); |
30 | |
31 | extern void NotifyMyFrontEnd(const char *channel, |
32 | const char *payload, |
33 | int32 srcPid); |
34 | |
35 | /* notify-related SQL statements */ |
36 | extern void Async_Notify(const char *channel, const char *payload); |
37 | extern void Async_Listen(const char *channel); |
38 | extern void Async_Unlisten(const char *channel); |
39 | extern void Async_UnlistenAll(void); |
40 | |
41 | /* perform (or cancel) outbound notify processing at transaction commit */ |
42 | extern void PreCommit_Notify(void); |
43 | extern void AtCommit_Notify(void); |
44 | extern void AtAbort_Notify(void); |
45 | extern void AtSubStart_Notify(void); |
46 | extern void AtSubCommit_Notify(void); |
47 | extern void AtSubAbort_Notify(void); |
48 | extern void AtPrepare_Notify(void); |
49 | extern void ProcessCompletedNotifies(void); |
50 | |
51 | /* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */ |
52 | extern void HandleNotifyInterrupt(void); |
53 | |
54 | /* process interrupts */ |
55 | extern void ProcessNotifyInterrupt(void); |
56 | |
57 | #endif /* ASYNC_H */ |
58 | |