PostgreSQL Source Code
git master
|
Go to the source code of this file.
Data Structures | |
struct | SpinDelayStatus |
Macros | |
#define | S_LOCK_FREE(lock) s_lock_free_sema(lock) |
#define | S_UNLOCK(lock) s_unlock_sema(lock) |
#define | S_INIT_LOCK(lock) s_init_lock_sema(lock, false) |
#define | TAS(lock) tas_sema(lock) |
#define | S_LOCK(lock) (TAS(lock) ? s_lock((lock), __FILE__, __LINE__, __func__) : 0) |
#define | SPIN_DELAY() ((void) 0) |
#define | TAS_SPIN(lock) TAS(lock) |
#define | DEFAULT_SPINS_PER_DELAY 100 |
#define | init_local_spin_delay(status) init_spin_delay(status, __FILE__, __LINE__, __func__) |
Typedefs | |
typedef int | slock_t |
Functions | |
bool | s_lock_free_sema (volatile slock_t *lock) |
void | s_unlock_sema (volatile slock_t *lock) |
void | s_init_lock_sema (volatile slock_t *lock, bool nested) |
int | tas_sema (volatile slock_t *lock) |
int | s_lock (volatile slock_t *lock, const char *file, int line, const char *func) |
void | set_spins_per_delay (int shared_spins_per_delay) |
int | update_spins_per_delay (int shared_spins_per_delay) |
static void | init_spin_delay (SpinDelayStatus *status, const char *file, int line, const char *func) |
void | perform_spin_delay (SpinDelayStatus *status) |
void | finish_spin_delay (SpinDelayStatus *status) |
Variables | |
PGDLLIMPORT slock_t | dummy_spinlock |
#define init_local_spin_delay | ( | status | ) | init_spin_delay(status, __FILE__, __LINE__, __func__) |
#define S_INIT_LOCK | ( | lock | ) | s_init_lock_sema(lock, false) |
#define S_LOCK_FREE | ( | lock | ) | s_lock_free_sema(lock) |
#define S_UNLOCK | ( | lock | ) | s_unlock_sema(lock) |
void finish_spin_delay | ( | SpinDelayStatus * | status | ) |
Definition at line 186 of file s_lock.c.
References SpinDelayStatus::cur_delay, Max, MAX_SPINS_PER_DELAY, Min, MIN_SPINS_PER_DELAY, and spins_per_delay.
Referenced by LockBufHdr(), LWLockWaitListLock(), s_lock(), and WaitBufHdrUnlocked().
|
inlinestatic |
Definition at line 852 of file s_lock.h.
References SpinDelayStatus::cur_delay, SpinDelayStatus::delays, SpinDelayStatus::file, SpinDelayStatus::func, SpinDelayStatus::line, and SpinDelayStatus::spins.
Referenced by s_lock().
void perform_spin_delay | ( | SpinDelayStatus * | status | ) |
Definition at line 126 of file s_lock.c.
References SpinDelayStatus::cur_delay, SpinDelayStatus::delays, fflush(), SpinDelayStatus::file, fprintf, SpinDelayStatus::func, SpinDelayStatus::line, MAX_DELAY_USEC, MIN_DELAY_USEC, NUM_DELAYS, pg_global_prng_state, pg_prng_double(), pg_usleep(), pgstat_report_wait_end(), pgstat_report_wait_start(), s_lock_stuck(), SPIN_DELAY, SpinDelayStatus::spins, spins_per_delay, and generate_unaccent_rules::stdout.
Referenced by LockBufHdr(), LWLockWaitListLock(), s_lock(), and WaitBufHdrUnlocked().
Definition at line 121 of file spin.c.
References idx(), NUM_ATOMICS_SEMAPHORES, NUM_SPINLOCK_SEMAPHORES, and s_check_valid().
Referenced by pg_atomic_init_flag_impl(), pg_atomic_init_u32_impl(), and pg_atomic_init_u64_impl().
int s_lock | ( | volatile slock_t * | lock, |
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 93 of file s_lock.c.
References SpinDelayStatus::delays, finish_spin_delay(), init_spin_delay(), perform_spin_delay(), and TAS_SPIN.
Referenced by test_spinlock().
void s_unlock_sema | ( | volatile slock_t * | lock | ) |
Definition at line 152 of file spin.c.
References PGSemaphoreUnlock(), s_check_valid(), and SpinlockSemaArray.
void set_spins_per_delay | ( | int | shared_spins_per_delay | ) |
Definition at line 207 of file s_lock.c.
References spins_per_delay.
Referenced by InitAuxiliaryProcess(), and InitProcess().
int tas_sema | ( | volatile slock_t * | lock | ) |
Definition at line 170 of file spin.c.
References PGSemaphoreTryLock(), s_check_valid(), and SpinlockSemaArray.
int update_spins_per_delay | ( | int | shared_spins_per_delay | ) |
Definition at line 218 of file s_lock.c.
References spins_per_delay.
Referenced by AuxiliaryProcKill(), and ProcKill().
|
extern |
Definition at line 65 of file s_lock.c.
Referenced by startup_hacks().