Header And Logo

PostgreSQL
| The world's most advanced open source database.

Defines | Functions

spin.h File Reference

#include "storage/s_lock.h"
Include dependency graph for spin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SpinLockInit(lock)   S_INIT_LOCK(lock)
#define SpinLockAcquire(lock)   S_LOCK(lock)
#define SpinLockRelease(lock)   S_UNLOCK(lock)
#define SpinLockFree(lock)   S_LOCK_FREE(lock)

Functions

int SpinlockSemas (void)

Define Documentation

#define SpinLockAcquire (   lock  )     S_LOCK(lock)

Definition at line 64 of file spin.h.

Referenced by AbortStrongLockAcquire(), AdvanceXLInsertBuffer(), AuxiliaryProcKill(), BeginStrongLockAcquire(), CheckpointerMain(), CheckRecoveryConsistency(), CheckXLogRemoved(), CreateCheckPoint(), CreateRestartPoint(), do_pg_start_backup(), do_pg_stop_backup(), element_alloc(), FirstCallSinceLastCheckpoint(), get_hash_entry(), GetCurrentChunkReplayStartTime(), GetFakeLSNForUnloggedRel(), GetFlushRecPtr(), GetInsertRecPtr(), GetLatestXTime(), GetNextXidAndEpoch(), GetRedoRecPtr(), GetReplicationApplyDelay(), GetReplicationTransferLatency(), GetWalRcvWriteRecPtr(), GetXLogReplayRecPtr(), GetXLogWriteRecPtr(), hash_search_with_hash_value(), HaveNFreeProcs(), HotStandbyActive(), InitAuxiliaryProcess(), InitProcess(), InitWalSenderSlot(), KnownAssignedXidsAdd(), KnownAssignedXidsGetAndSetXmin(), KnownAssignedXidsGetOldestXmin(), KnownAssignedXidsSearch(), lock_twophase_recover(), LockRefindAndRelease(), LWLockAcquire(), LWLockAcquireOrWait(), LWLockAssign(), LWLockConditionalAcquire(), LWLockRelease(), pg_stat_get_wal_senders(), pg_stat_statements(), pgss_store(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), ProcKill(), ProcSendSignal(), PublishStartupProcessInformation(), RecoveryInProgress(), RecoveryIsPaused(), RecoveryRestartPoint(), RemoveLocalLock(), RequestCheckpoint(), RequestXLogStreaming(), SetCurrentChunkStartTime(), SetLatestXTime(), SetRecoveryPause(), SetWalWriterSleeping(), ShmemAlloc(), ShutdownWalRcv(), SIGetDataEntries(), SIInsertDataEntries(), StartReplication(), StartupXLOG(), UpdateLastRemovedPtr(), UpdateMinRecoveryPoint(), WalRcvDie(), WalRcvRunning(), WalRcvStreaming(), WalRcvWaitForStartPosition(), WalReceiverMain(), WalSndRqstFileReload(), WalSndSetState(), xlog_redo(), XLogBackgroundFlush(), XLogFlush(), XLogInsert(), XLogNeedsFlush(), XLogRead(), XLogSend(), XLogSetAsyncXactLSN(), XLogWalRcvFlush(), and XLogWrite().

#define SpinLockFree (   lock  )     S_LOCK_FREE(lock)

Definition at line 68 of file spin.h.

#define SpinLockInit (   lock  )     S_INIT_LOCK(lock)
#define SpinLockRelease (   lock  )     S_UNLOCK(lock)

Definition at line 66 of file spin.h.

Referenced by AbortStrongLockAcquire(), AdvanceXLInsertBuffer(), AuxiliaryProcKill(), BeginStrongLockAcquire(), CheckpointerMain(), CheckRecoveryConsistency(), CheckXLogRemoved(), CreateCheckPoint(), CreateRestartPoint(), do_pg_start_backup(), do_pg_stop_backup(), element_alloc(), FirstCallSinceLastCheckpoint(), get_hash_entry(), GetCurrentChunkReplayStartTime(), GetFakeLSNForUnloggedRel(), GetFlushRecPtr(), GetInsertRecPtr(), GetLatestXTime(), GetNextXidAndEpoch(), GetRedoRecPtr(), GetReplicationApplyDelay(), GetReplicationTransferLatency(), GetWalRcvWriteRecPtr(), GetXLogReplayRecPtr(), GetXLogWriteRecPtr(), hash_search_with_hash_value(), HaveNFreeProcs(), HotStandbyActive(), InitAuxiliaryProcess(), InitProcess(), InitWalSenderSlot(), KnownAssignedXidsAdd(), KnownAssignedXidsGetAndSetXmin(), KnownAssignedXidsGetOldestXmin(), KnownAssignedXidsSearch(), lock_twophase_recover(), LockRefindAndRelease(), LWLockAcquire(), LWLockAcquireOrWait(), LWLockAssign(), LWLockConditionalAcquire(), LWLockRelease(), pg_stat_get_wal_senders(), pg_stat_statements(), pgss_store(), ProcessStandbyReplyMessage(), ProcessWalSndrMessage(), ProcKill(), ProcSendSignal(), PublishStartupProcessInformation(), RecoveryInProgress(), RecoveryIsPaused(), RecoveryRestartPoint(), RemoveLocalLock(), RequestCheckpoint(), RequestXLogStreaming(), SetCurrentChunkStartTime(), SetLatestXTime(), SetRecoveryPause(), SetWalWriterSleeping(), ShmemAlloc(), ShutdownWalRcv(), SIGetDataEntries(), SIInsertDataEntries(), StartReplication(), StartupXLOG(), UpdateLastRemovedPtr(), UpdateMinRecoveryPoint(), WalRcvDie(), WalRcvRunning(), WalRcvStreaming(), WalRcvWaitForStartPosition(), WalReceiverMain(), WalSndRqstFileReload(), WalSndSetState(), xlog_redo(), XLogBackgroundFlush(), XLogFlush(), XLogInsert(), XLogNeedsFlush(), XLogRead(), XLogSend(), XLogSetAsyncXactLSN(), XLogWalRcvFlush(), and XLogWrite().


Function Documentation

int SpinlockSemas ( void   ) 

Definition at line 52 of file spin.c.

References max_wal_senders, NBuffers, and NumLWLocks().

Referenced by CreateSharedMemoryAndSemaphores().

{
    int     nsemas;

    /*
     * It would be cleaner to distribute this logic into the affected modules,
     * similar to the way shmem space estimation is handled.
     *
     * For now, though, there are few enough users of spinlocks that we just
     * keep the knowledge here.
     */
    nsemas = NumLWLocks();      /* one for each lwlock */
    nsemas += NBuffers;         /* one for each buffer header */
    nsemas += max_wal_senders;  /* one for each wal sender process */
    nsemas += 30;               /* plus a bunch for other small-scale use */

    return nsemas;
}