00001 /*------------------------------------------------------------------------- 00002 * 00003 * async.h 00004 * Asynchronous notification: NOTIFY, LISTEN, UNLISTEN 00005 * 00006 * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 00007 * Portions Copyright (c) 1994, Regents of the University of California 00008 * 00009 * src/include/commands/async.h 00010 * 00011 *------------------------------------------------------------------------- 00012 */ 00013 #ifndef ASYNC_H 00014 #define ASYNC_H 00015 00016 #include "fmgr.h" 00017 00018 /* 00019 * The number of SLRU page buffers we use for the notification queue. 00020 */ 00021 #define NUM_ASYNC_BUFFERS 8 00022 00023 extern bool Trace_notify; 00024 00025 extern Size AsyncShmemSize(void); 00026 extern void AsyncShmemInit(void); 00027 00028 /* notify-related SQL statements */ 00029 extern void Async_Notify(const char *channel, const char *payload); 00030 extern void Async_Listen(const char *channel); 00031 extern void Async_Unlisten(const char *channel); 00032 extern void Async_UnlistenAll(void); 00033 00034 /* notify-related SQL functions */ 00035 extern Datum pg_listening_channels(PG_FUNCTION_ARGS); 00036 extern Datum pg_notify(PG_FUNCTION_ARGS); 00037 00038 /* perform (or cancel) outbound notify processing at transaction commit */ 00039 extern void PreCommit_Notify(void); 00040 extern void AtCommit_Notify(void); 00041 extern void AtAbort_Notify(void); 00042 extern void AtSubStart_Notify(void); 00043 extern void AtSubCommit_Notify(void); 00044 extern void AtSubAbort_Notify(void); 00045 extern void AtPrepare_Notify(void); 00046 extern void ProcessCompletedNotifies(void); 00047 00048 /* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */ 00049 extern void HandleNotifyInterrupt(void); 00050 00051 /* 00052 * enable/disable processing of inbound notifies directly from signal handler. 00053 * The enable routine first performs processing of any inbound notifies that 00054 * have occurred since the last disable. 00055 */ 00056 extern void EnableNotifyInterrupt(void); 00057 extern bool DisableNotifyInterrupt(void); 00058 00059 #endif /* ASYNC_H */