This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: DB_THREAD support in Berkeley DB/glibc
- To: David Edelsohn <dje at watson dot ibm dot com>, Daniel Jacobowitz <drow at false dot org>
- Subject: Re: DB_THREAD support in Berkeley DB/glibc
- From: Tony Mantler <eek at escape dot ca>
- Date: Tue, 28 Dec 1999 17:21:36 -0600
- Cc: linuxppc-dev at lists dot linuxppc dot org, libc-alpha at sourceware dot cygnus dot com
- Organisation: Judean People's Front; Department of Whips, Chains, Thumb-Screws, Six Tons of Whipping Cream, the Entire Soprano Section of the Mormon Tabernacle Choir and Guest Apperances of Eva Peron aka Eric Conspiracy Secret Laboratories
- References: Message from Daniel Jacobowitz <drow@false.org> of "Tue, 28Dec 1999 17:05:39 EST." <19991228170539.A18218@drow.res.cmu.edu>
At 4:28 PM -0600 12/28/99, David Edelsohn wrote:
> The TSL_UNSET still does not look sufficient to me. It needs to
>use lwarx/stwcx as well:
>
>#define TSL_UNSET(tsl) ({
> register tsl_t *__l = (tsl);
> register tsl_t __r1;
> __asm__ __volatile__ ("
> sync
> 10: lwarx %0,0,%1
> stwcx. %2,0,%1
> bne- 10b
> isync"
> : "=&r" (__r1) : "r" (__l), "r" (0));
> })
Why? It would seem to me that the only time that atomic code would be
tripped is if the calling thread didn't have the lock when it tried to
clear it (umm, biiiig no-no), and a different thread tried to set the lock
at the same time.
I would agree with Daniel Jacobowitz's code, all that should be needed is a
sync and write for the unset.
Cheers - Tony :)
--
Tony Mantler Renaissance Nerd Extraordinaire eek@escape.ca
Winnipeg, Manitoba, Canada http://www.escape.ca/~eek