async.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*-------------------------------------------------------------------------
  2. *
  3. * async.h
  4. * Asynchronous notification: NOTIFY, LISTEN, UNLISTEN
  5. *
  6. * Portions Copyright (c) 1996-2016, 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. #include <signal.h>
  16. #include "fmgr.h"
  17. /*
  18. * The number of SLRU page buffers we use for the notification queue.
  19. */
  20. #define NUM_ASYNC_BUFFERS 8
  21. extern bool Trace_notify;
  22. extern volatile sig_atomic_t notifyInterruptPending;
  23. extern Size AsyncShmemSize(void);
  24. extern void AsyncShmemInit(void);
  25. extern void NotifyMyFrontEnd(const char *channel,
  26. const char *payload,
  27. int32 srcPid);
  28. /* notify-related SQL statements */
  29. extern void Async_Notify(const char *channel, const char *payload);
  30. extern void Async_Listen(const char *channel);
  31. extern void Async_Unlisten(const char *channel);
  32. extern void Async_UnlistenAll(void);
  33. /* notify-related SQL functions */
  34. extern Datum pg_listening_channels(PG_FUNCTION_ARGS);
  35. extern Datum pg_notify(PG_FUNCTION_ARGS);
  36. extern Datum pg_notification_queue_usage(PG_FUNCTION_ARGS);
  37. /* perform (or cancel) outbound notify processing at transaction commit */
  38. extern void PreCommit_Notify(void);
  39. extern void AtCommit_Notify(void);
  40. extern void AtAbort_Notify(void);
  41. extern void AtSubStart_Notify(void);
  42. extern void AtSubCommit_Notify(void);
  43. extern void AtSubAbort_Notify(void);
  44. extern void AtPrepare_Notify(void);
  45. extern void ProcessCompletedNotifies(void);
  46. /* signal handler for inbound notifies (PROCSIG_NOTIFY_INTERRUPT) */
  47. extern void HandleNotifyInterrupt(void);
  48. /* process interrupts */
  49. extern void ProcessNotifyInterrupt(void);
  50. #endif /* ASYNC_H */