From: | mlw <markw(at)mohawksoft(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Some interesting results from tweaking spinlocks |
Date: | 2002-01-05 15:11:29 |
Message-ID: | 3C3717A1.C50D65C9@mohawksoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
mlw wrote:
[snip]
#define SPINS_PER_DELAY 2000
#define DELAY_MSEC 10
#define TIMEOUT_MSEC (60 * 1000)
ATOMIC_INC(lock->waiters);
while (TAS(lock))
{
if ( (++spins > SPINS_PER_DELAY) || (lock->waiters >= CPUS) )
{
if (++delays > (TIMEOUT_MSEC / DELAY_MSEC))
s_lock_stuck(lock, file, line);
delay.tv_sec = 0;
delay.tv_usec = DELAY_MSEC * 1000;
(void) select(0, NULL, NULL, NULL, &delay);
spins = 0;
}
}
ATOMIC_DEC(lock->waiters);
This is better function, the one in my previous post was non-sense, I should
have coffee BEFORE I post.
From | Date | Subject | |
---|---|---|---|
Next Message | Bear Giles | 2002-01-05 15:46:38 | Re: pgcryto strangeness... |
Previous Message | mlw | 2002-01-05 13:12:42 | Re: Some interesting results from tweaking spinlocks |