PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <time.h>
#include <unistd.h>
#include "common/pg_prng.h"
#include "port/atomics.h"
#include "storage/s_lock.h"
#include "utils/wait_event.h"
Go to the source code of this file.
Macros | |
#define | MIN_SPINS_PER_DELAY 10 |
#define | MAX_SPINS_PER_DELAY 1000 |
#define | NUM_DELAYS 1000 |
#define | MIN_DELAY_USEC 1000L |
#define | MAX_DELAY_USEC 1000000L |
Functions | |
static void | s_lock_stuck (const char *file, int line, const char *func) |
int | s_lock (volatile slock_t *lock, const char *file, int line, const char *func) |
void | s_unlock (volatile slock_t *lock) |
void | perform_spin_delay (SpinDelayStatus *status) |
void | finish_spin_delay (SpinDelayStatus *status) |
void | set_spins_per_delay (int shared_spins_per_delay) |
int | update_spins_per_delay (int shared_spins_per_delay) |
Variables | |
static int | spins_per_delay = DEFAULT_SPINS_PER_DELAY |
void finish_spin_delay | ( | SpinDelayStatus * | status | ) |
Definition at line 187 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().
void perform_spin_delay | ( | SpinDelayStatus * | status | ) |
Definition at line 127 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().
int s_lock | ( | volatile slock_t * | lock, |
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 99 of file s_lock.c.
References SpinDelayStatus::delays, finish_spin_delay(), init_spin_delay(), perform_spin_delay(), and TAS_SPIN.
Referenced by test_spinlock().
|
static |
void s_unlock | ( | volatile slock_t * | lock | ) |
void set_spins_per_delay | ( | int | shared_spins_per_delay | ) |
Definition at line 208 of file s_lock.c.
References spins_per_delay.
Referenced by InitAuxiliaryProcess(), and InitProcess().
int update_spins_per_delay | ( | int | shared_spins_per_delay | ) |
Definition at line 219 of file s_lock.c.
References spins_per_delay.
Referenced by AuxiliaryProcKill(), and ProcKill().
|
static |
Definition at line 73 of file s_lock.c.
Referenced by finish_spin_delay(), perform_spin_delay(), set_spins_per_delay(), and update_spins_per_delay().