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

Tom Ivar Helbekkmo <tih@hamartun.priv.no>

From: Tom Ivar Helbekkmo <tih@Hamartun.Priv.NO>
To: dg@illustra.com (David Gould)
Cc: maillist@candle.pha.pa.us, scrappy@hub.org, dz@cs.unitn.it, pgsql-hackers@postgreSQL.org
Date: 1998-04-02T04:52:33Z
Lists: pgsql-hackers
* David Gould
|
| What do you mean "now with the return values from tas() swapped"? I think
| your code looks ok, but just want to be sure we are following the same
| grand plan...

I just meant that my original code (which has been posted before) had
the tas() function implemented so that it returned 0 on failure, not
on success, as you asked for.  Thus, I had to swap the sense of the
return value.  In practice, I changed

	clrl r0			; clear register r0
	bbssi $0,(%1),1f	; branch on bit set else set
	incl r0			; increment register r0
1:	movl r0,%0		; return register r0

	[...]

#define	S_LOCK(addr)		do { while (!tas(addr)) ; } while (0)

...into...

	movl $1, r0		; set register r0 to 1
	bbssi $0,(%1),1f	; branch on bit set else set
	clrl r0			; clear register r0
1:	movl r0,%0		; return register r0

	[...]

#define	S_LOCK(addr)		do { while (tas(addr)) ; } while (0)

-tih
-- 
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"