PostgreSQL Source Code git master
|
#include "utils/resowner.h"
Go to the source code of this file.
Data Structures | |
struct | WaitEvent |
Macros | |
#define | WL_LATCH_SET (1 << 0) |
#define | WL_SOCKET_READABLE (1 << 1) |
#define | WL_SOCKET_WRITEABLE (1 << 2) |
#define | WL_TIMEOUT (1 << 3) /* not for WaitEventSetWait() */ |
#define | WL_POSTMASTER_DEATH (1 << 4) |
#define | WL_EXIT_ON_PM_DEATH (1 << 5) |
#define | WL_SOCKET_CONNECTED WL_SOCKET_WRITEABLE |
#define | WL_SOCKET_CLOSED (1 << 7) |
#define | WL_SOCKET_ACCEPT WL_SOCKET_READABLE |
#define | WL_SOCKET_MASK |
Typedefs | |
typedef struct WaitEvent | WaitEvent |
typedef struct WaitEventSet | WaitEventSet |
Functions | |
void | InitializeWaitEventSupport (void) |
WaitEventSet * | CreateWaitEventSet (ResourceOwner resowner, int nevents) |
void | FreeWaitEventSet (WaitEventSet *set) |
void | FreeWaitEventSetAfterFork (WaitEventSet *set) |
int | AddWaitEventToSet (WaitEventSet *set, uint32 events, pgsocket fd, struct Latch *latch, void *user_data) |
void | ModifyWaitEvent (WaitEventSet *set, int pos, uint32 events, struct Latch *latch) |
int | WaitEventSetWait (WaitEventSet *set, long timeout, WaitEvent *occurred_events, int nevents, uint32 wait_event_info) |
int | GetNumRegisteredWaitEvents (WaitEventSet *set) |
bool | WaitEventSetCanReportClosed (void) |
void | WakeupMyProc (void) |
void | WakeupOtherProc (int pid) |
#define WL_EXIT_ON_PM_DEATH (1 << 5) |
Definition at line 39 of file waiteventset.h.
#define WL_LATCH_SET (1 << 0) |
Definition at line 34 of file waiteventset.h.
#define WL_POSTMASTER_DEATH (1 << 4) |
Definition at line 38 of file waiteventset.h.
#define WL_SOCKET_ACCEPT WL_SOCKET_READABLE |
Definition at line 51 of file waiteventset.h.
#define WL_SOCKET_CLOSED (1 << 7) |
Definition at line 46 of file waiteventset.h.
#define WL_SOCKET_CONNECTED WL_SOCKET_WRITEABLE |
Definition at line 44 of file waiteventset.h.
#define WL_SOCKET_MASK |
Definition at line 53 of file waiteventset.h.
#define WL_SOCKET_READABLE (1 << 1) |
Definition at line 35 of file waiteventset.h.
#define WL_SOCKET_WRITEABLE (1 << 2) |
Definition at line 36 of file waiteventset.h.
#define WL_TIMEOUT (1 << 3) /* not for WaitEventSetWait() */ |
Definition at line 37 of file waiteventset.h.
typedef struct WaitEventSet WaitEventSet |
Definition at line 71 of file waiteventset.h.
int AddWaitEventToSet | ( | WaitEventSet * | set, |
uint32 | events, | ||
pgsocket | fd, | ||
struct Latch * | latch, | ||
void * | user_data | ||
) |
Definition at line 569 of file waiteventset.c.
References Assert(), elog, ERROR, WaitEventSet::events, WaitEventSet::exit_on_postmaster_death, fd(), WaitEventSet::latch, WaitEventSet::latch_pos, MyProcPid, WaitEventSet::nevents, WaitEventSet::nevents_space, Latch::owner_pid, PGINVALID_SOCKET, WaitEvent::pos, postmaster_alive_fds, POSTMASTER_FD_WATCH, selfpipe_readfd, WaitEventAdjustPoll(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, WL_POSTMASTER_DEATH, and WL_SOCKET_MASK.
Referenced by ConfigurePostmasterWaitSet(), ExecAppendAsyncEventWait(), InitializeLatchWaitSet(), postgresForeignAsyncConfigureWait(), pq_init(), SysLoggerMain(), and WaitLatchOrSocket().
WaitEventSet * CreateWaitEventSet | ( | ResourceOwner | resowner, |
int | nevents | ||
) |
Definition at line 363 of file waiteventset.c.
References AcquireExternalFD(), close, data, elog, ERROR, WaitEventSet::events, WaitEventSet::exit_on_postmaster_death, WaitEventSet::latch, MAXALIGN, MemoryContextAllocZero(), WaitEventSet::nevents_space, WaitEventSet::owner, pgwin32_signal_event, WaitEventSet::pollfds, ReleaseExternalFD(), ResourceOwnerEnlarge(), ResourceOwnerRememberWaitEventSet(), StaticAssertStmt, and TopMemoryContext.
Referenced by ConfigurePostmasterWaitSet(), ExecAppendAsyncEventWait(), InitializeLatchWaitSet(), pq_init(), SysLoggerMain(), and WaitLatchOrSocket().
void FreeWaitEventSet | ( | WaitEventSet * | set | ) |
Definition at line 480 of file waiteventset.c.
References close, WaitEventSet::events, WaitEventSet::nevents, WaitEventSet::owner, pfree(), ReleaseExternalFD(), ResourceOwnerForgetWaitEventSet(), WL_LATCH_SET, and WL_POSTMASTER_DEATH.
Referenced by ConfigurePostmasterWaitSet(), ExecAppendAsyncEventWait(), ResOwnerReleaseWaitEventSet(), and WaitLatchOrSocket().
void FreeWaitEventSetAfterFork | ( | WaitEventSet * | set | ) |
Definition at line 523 of file waiteventset.c.
References close, pfree(), and ReleaseExternalFD().
Referenced by ClosePostmasterPorts().
int GetNumRegisteredWaitEvents | ( | WaitEventSet * | set | ) |
Definition at line 1882 of file waiteventset.c.
References WaitEventSet::nevents.
Referenced by ExecAppendAsyncEventWait(), and postgresForeignAsyncConfigureWait().
void InitializeWaitEventSupport | ( | void | ) |
Definition at line 240 of file waiteventset.c.
References Assert(), close, elog, FATAL, IsUnderPostmaster, latch_sigurg_handler(), MyProcPid, pqsignal, ReleaseExternalFD(), ReserveExternalFD(), selfpipe_owner_pid, selfpipe_readfd, selfpipe_writefd, and UnBlockSig.
Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().
void ModifyWaitEvent | ( | WaitEventSet * | set, |
int | pos, | ||
uint32 | events, | ||
struct Latch * | latch | ||
) |
Definition at line 655 of file waiteventset.c.
References Assert(), elog, ERROR, WaitEventSet::events, WaitEvent::events, WaitEventSet::exit_on_postmaster_death, WaitEventSet::latch, MyProcPid, Latch::owner_pid, WaitEventAdjustPoll(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and WL_POSTMASTER_DEATH.
Referenced by pq_check_connection(), secure_read(), secure_write(), SwitchBackToLocalLatch(), SwitchToSharedLatch(), WaitLatch(), and WalSndWait().
bool WaitEventSetCanReportClosed | ( | void | ) |
Definition at line 1867 of file waiteventset.c.
Referenced by check_client_connection_check_interval().
int WaitEventSetWait | ( | WaitEventSet * | set, |
long | timeout, | ||
WaitEvent * | occurred_events, | ||
int | nevents, | ||
uint32 | wait_event_info | ||
) |
Definition at line 1037 of file waiteventset.c.
References Assert(), WaitEventSet::events, WaitEvent::events, WaitEvent::fd, INSTR_TIME_GET_MILLISEC, INSTR_TIME_SET_CURRENT, INSTR_TIME_SET_ZERO, INSTR_TIME_SUBTRACT, Latch::is_set, WaitEventSet::latch, WaitEventSet::latch_pos, Latch::maybe_sleeping, pg_memory_barrier, PGINVALID_SOCKET, pgstat_report_wait_end(), pgstat_report_wait_start(), pgwin32_dispatch_queued_signals(), WaitEvent::pos, start_time, WaitEvent::user_data, WaitEventSetWaitBlock(), waiting, and WL_LATCH_SET.
Referenced by ExecAppendAsyncEventWait(), pq_check_connection(), secure_read(), secure_write(), ServerLoop(), SysLoggerMain(), WaitLatch(), WaitLatchOrSocket(), and WalSndWait().
void WakeupMyProc | ( | void | ) |
Definition at line 2019 of file waiteventset.c.
References kill, MyProcPid, sendSelfPipeByte(), and waiting.
Referenced by SetLatch().
void WakeupOtherProc | ( | int | pid | ) |