mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Change PG_DELAY from msec to usec and use it consistenly rather than
select(). Add Win32 Sleep() for delay.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.23 2003/12/27 20:58:58 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/s_lock.c,v 1.24 2004/01/09 21:08:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "storage/s_lock.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
/*
|
||||
* s_lock_stuck() - complain about a stuck spinlock
|
||||
@@ -84,7 +84,6 @@ s_lock(volatile slock_t *lock, const char *file, int line)
|
||||
int spins = 0;
|
||||
int delays = 0;
|
||||
int cur_delay = MIN_DELAY_CSEC;
|
||||
struct timeval delay;
|
||||
|
||||
while (TAS(lock))
|
||||
{
|
||||
@@ -97,9 +96,7 @@ s_lock(volatile slock_t *lock, const char *file, int line)
|
||||
if (++delays > NUM_DELAYS)
|
||||
s_lock_stuck(lock, file, line);
|
||||
|
||||
delay.tv_sec = cur_delay / 100;
|
||||
delay.tv_usec = (cur_delay % 100) * 10000;
|
||||
(void) select(0, NULL, NULL, NULL, &delay);
|
||||
PG_USLEEP(cur_delay * 10000);
|
||||
|
||||
#if defined(S_LOCK_TEST)
|
||||
fprintf(stdout, "*");
|
||||
|
Reference in New Issue
Block a user