Re: [HACKERS] Re: [PATCHES] patches for 6.2.1p6

From: dg(at)illustra(dot)com (David Gould)
To: tih(at)Hamartun(dot)Priv(dot)NO (Tom Ivar Helbekkmo)
Cc: maillist(at)candle(dot)pha(dot)pa(dot)us, scrappy(at)hub(dot)org, dz(at)cs(dot)unitn(dot)it, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: [PATCHES] patches for 6.2.1p6
Date: 1998-03-18 23:51:51
Message-ID: 9803182351.AA05332@hawk.illustra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> * Bruce Momjian
> | Just a warning that this is not going to be easy. We have OS-specific
> | code for spinlocks in include/storage/s_lock.h and
> | backend/storage/buffer/s_lock.c. So each S_LOCK macro call has to have
> | its test-and-set logic de-coupled with its while-lock-fail-try-again
> | logic. Most of them are easy, but some like VAX:
> |
> | #define S_LOCK(addr) __asm__("1: bbssi $0,(%0),1b": :"r"(addr))
> |
> | are hard to de-couple. Now, I did not know we supported NetBSD on VAX.
> | Does it work, anyone? Can I remove it?
>
> Yes, it works. No, please don't break it. Heck, I only just got it
> in in time for 6.3! :-) The not-so-busy-waiting-spinlock stuff can be
> put in on a platform at a time -- I'll expand the VAX version to do
> the right thing once someone has done another platform, so I can see
> what's the preferred way of doing it.
>
> -tih

I won't. I hope.

Seriously, if you want to, please create a function to emulate the following:

/*
* tas(lock)
*
* Access to platform specific test_and_set functionality. Given pointer to
* lock attempts to acquire the lock atomically.
*
* Returns 0 for success, nonzero for failure.
*/
typedef slock_t unsigned char; /* or whatever works on the platform */

int tas(slock_t *lock)
{
slock_t tmp;

/* atomic, interlocked */
tmp = *lock;
*lock = -1; /* any nonzero will do here */

return (tmp != 0);
}

Given this, I can fold the VAX right into the grand scheme, just like a
normal computer (;-)).

-dg

David Gould dg(at)illustra(dot)com 510.628.3783 or 510.305.9468
Informix Software (No, really) 300 Lakeside Drive Oakland, CA 94612
- I realize now that irony has no place in business communications.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michal Mosiewicz 1998-03-19 00:05:53 Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
Previous Message Mattias Kregert 1998-03-18 22:29:58 Timezone problems / HAVE_INT_TIMEZINE