PostgreSQL Source Code git master
|
#include "postgres.h"
#include "miscadmin.h"
#include "port/atomics.h"
#include "storage/latch.h"
#include "storage/waiteventset.h"
#include "utils/resowner.h"
Go to the source code of this file.
Macros | |
#define | LatchWaitSetLatchPos 0 |
#define | LatchWaitSetPostmasterDeathPos 1 |
Functions | |
void | InitializeLatchWaitSet (void) |
void | InitLatch (Latch *latch) |
void | InitSharedLatch (Latch *latch) |
void | OwnLatch (Latch *latch) |
void | DisownLatch (Latch *latch) |
int | WaitLatch (Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info) |
int | WaitLatchOrSocket (Latch *latch, int wakeEvents, pgsocket sock, long timeout, uint32 wait_event_info) |
void | SetLatch (Latch *latch) |
void | ResetLatch (Latch *latch) |
Variables | |
static WaitEventSet * | LatchWaitSet |
void DisownLatch | ( | Latch * | latch | ) |
Definition at line 144 of file latch.c.
References Assert(), Latch::is_shared, MyProcPid, and Latch::owner_pid.
Referenced by AuxiliaryProcKill(), ProcKill(), and ShutdownWalRecovery().
void InitializeLatchWaitSet | ( | void | ) |
Definition at line 35 of file latch.c.
References AddWaitEventToSet(), Assert(), CreateWaitEventSet(), IsUnderPostmaster, LatchWaitSet, LatchWaitSetLatchPos, LatchWaitSetPostmasterDeathPos, MyLatch, PG_USED_FOR_ASSERTS_ONLY, PGINVALID_SOCKET, WL_EXIT_ON_PM_DEATH, and WL_LATCH_SET.
Referenced by InitPostmasterChild(), and InitStandaloneProcess().
void InitLatch | ( | Latch * | latch | ) |
Definition at line 63 of file latch.c.
References elog, ERROR, Latch::is_set, Latch::is_shared, Latch::maybe_sleeping, MyProcPid, and Latch::owner_pid.
Referenced by InitProcessLocalLatch().
void InitSharedLatch | ( | Latch * | latch | ) |
Definition at line 93 of file latch.c.
References elog, ERROR, Latch::is_set, Latch::is_shared, Latch::maybe_sleeping, and Latch::owner_pid.
Referenced by InitProcGlobal(), and XLogRecoveryShmemInit().
void OwnLatch | ( | Latch * | latch | ) |
Definition at line 126 of file latch.c.
References Assert(), elog, Latch::is_shared, MyProcPid, Latch::owner_pid, and PANIC.
Referenced by InitAuxiliaryProcess(), InitProcess(), and InitWalRecovery().
void ResetLatch | ( | Latch * | latch | ) |
Definition at line 372 of file latch.c.
References Assert(), Latch::is_set, Latch::maybe_sleeping, MyProcPid, Latch::owner_pid, and pg_memory_barrier.
Referenced by ApplyLauncherMain(), autoprewarm_main(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CheckpointWriteDelay(), ConditionVariableTimedSleep(), copy_read_data(), do_pg_backup_stop(), ExecAppendAsyncEventWait(), gather_readnext(), IoWorkerMain(), lazy_truncate_heap(), libpqsrv_cancel(), libpqsrv_connect_internal(), libpqsrv_get_result(), LogicalParallelApplyLoop(), logicalrep_worker_stop_internal(), LogicalRepApplyLoop(), mq_putmessage(), pa_send_data(), pa_wait_for_xact_state(), pg_promote(), pg_sleep(), pg_wait_until_termination(), pgarch_MainLoop(), pgfdw_get_cleanup_result(), pq_check_connection(), ProcessPendingWrites(), ProcSleep(), ProcWaitForSignal(), recoveryApplyDelay(), secure_read(), secure_write(), ServerLoop(), shm_mq_receive_bytes(), shm_mq_send_bytes(), shm_mq_wait_internal(), ShutDownSlotSync(), summarizer_wait_for_wal(), SyncRepWaitForLSN(), SysLoggerMain(), test_shm_mq_pipelined(), throttle(), wait_for_relation_state_change(), wait_for_slot_activity(), wait_for_worker_state_change(), wait_for_workers_to_become_ready(), WaitForBackgroundWorkerShutdown(), WaitForBackgroundWorkerStartup(), WaitForParallelWorkersToAttach(), WaitForParallelWorkersToFinish(), WaitForReplicationWorkerAttach(), WaitForWALToBecomeAvailable(), WalRcvWaitForStartPosition(), WalReceiverMain(), WalSndLoop(), WalSndWaitForWal(), WalWriterMain(), and worker_spi_main().
void SetLatch | ( | Latch * | latch | ) |
Definition at line 288 of file latch.c.
References Latch::is_set, Latch::maybe_sleeping, MyProcPid, Latch::owner_pid, pg_memory_barrier, WakeupMyProc(), and WakeupOtherProc().
Referenced by avl_sigusr2_handler(), CheckDeadLockAlert(), ClientCheckTimeoutHandler(), ConditionVariableBroadcast(), ConditionVariableSignal(), die(), ForwardSyncRequest(), handle_pm_child_exit_signal(), handle_pm_pmsignal_signal(), handle_pm_reload_request_signal(), handle_pm_shutdown_request_signal(), handle_sig_alarm(), HandleCatchupInterrupt(), HandleNotifyInterrupt(), HandleParallelApplyMessageInterrupt(), HandleParallelMessageInterrupt(), IdleInTransactionSessionTimeoutHandler(), IdleSessionTimeoutHandler(), IdleStatsUpdateTimeoutHandler(), IoWorkerMain(), logicalrep_worker_wakeup_ptr(), pgaio_worker_submit_internal(), pgarch_waken_stop(), PgArchWakeup(), ProcessClientReadInterrupt(), ProcessClientWriteInterrupt(), ProcessPendingWrites(), ProcSendSignal(), procsignal_sigusr1_handler(), ProcWakeup(), ReqShutdownXLOG(), RequestCheckpoint(), RequestXLogStreaming(), shm_mq_detach_internal(), shm_mq_inc_bytes_read(), shm_mq_send_bytes(), shm_mq_sendv(), shm_mq_set_receiver(), shm_mq_set_sender(), SignalHandlerForConfigReload(), SignalHandlerForShutdownRequest(), sigUsr1Handler(), StatementCancelHandler(), StrategyGetBuffer(), SwitchBackToLocalLatch(), SwitchToSharedLatch(), SyncRepWakeQueue(), test_shm_mq_main(), TransactionTimeoutHandler(), WakeupRecovery(), WakeupWalSummarizer(), WalRcvForceReply(), WalSndLastCycleHandler(), WalSndWaitForWal(), and XLogSetAsyncXactLSN().
Definition at line 172 of file latch.c.
References Assert(), IsUnderPostmaster, LatchWaitSet, LatchWaitSetLatchPos, LatchWaitSetPostmasterDeathPos, ModifyWaitEvent(), WaitEventSetWait(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, WL_POSTMASTER_DEATH, and WL_TIMEOUT.
Referenced by ApplyLauncherMain(), autoprewarm_main(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CheckpointWriteDelay(), ConditionVariableTimedSleep(), do_pg_backup_stop(), gather_readnext(), IoWorkerMain(), lazy_truncate_heap(), LogicalParallelApplyLoop(), logicalrep_worker_stop_internal(), mq_putmessage(), pa_send_data(), pa_wait_for_xact_state(), pg_promote(), pg_sleep(), pg_wait_until_termination(), pgarch_MainLoop(), ProcSleep(), ProcWaitForSignal(), recoveryApplyDelay(), RegisterSyncRequest(), shm_mq_receive_bytes(), shm_mq_send_bytes(), shm_mq_wait_internal(), ShutDownSlotSync(), summarizer_wait_for_wal(), SyncRepWaitForLSN(), test_shm_mq_pipelined(), throttle(), wait_for_relation_state_change(), wait_for_slot_activity(), wait_for_worker_state_change(), wait_for_workers_to_become_ready(), WaitForBackgroundWorkerShutdown(), WaitForBackgroundWorkerStartup(), WaitForParallelWorkersToAttach(), WaitForParallelWorkersToFinish(), WaitForReplicationWorkerAttach(), WaitForWALToBecomeAvailable(), WalRcvWaitForStartPosition(), WalSummarizerMain(), WalWriterMain(), and worker_spi_main().
int WaitLatchOrSocket | ( | Latch * | latch, |
int | wakeEvents, | ||
pgsocket | sock, | ||
long | timeout, | ||
uint32 | wait_event_info | ||
) |
Definition at line 221 of file latch.c.
References AddWaitEventToSet(), Assert(), CreateWaitEventSet(), CurrentResourceOwner, FreeWaitEventSet(), IsUnderPostmaster, PGINVALID_SOCKET, WaitEventSetWait(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, WL_POSTMASTER_DEATH, WL_SOCKET_MASK, and WL_TIMEOUT.
Referenced by be_tls_open_server(), copy_read_data(), libpqsrv_cancel(), libpqsrv_connect_internal(), libpqsrv_get_result(), LogicalRepApplyLoop(), pgfdw_get_cleanup_result(), read_or_wait(), secure_open_gssapi(), and WalReceiverMain().
|
static |
Definition at line 28 of file latch.c.
Referenced by InitializeLatchWaitSet(), and WaitLatch().