This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: Another LinuxThreads bug.
- To: Xavier Leroy <Xavier dot Leroy at inria dot fr>
- Subject: Re: Another LinuxThreads bug.
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- Date: Tue, 11 Jan 2000 08:23:57 -0800 (PST)
- cc: libc-alpha at sourceware dot cygnus dot com
On Tue, 11 Jan 2000, Xavier Leroy wrote:
> > ... or, more likely, that he doesn't support recursive read
> > locks. We know how Dave feels about recursive locks. I don't have a
> > book, but I can look at it in a bookstore
>
> The code is on-line at
> http://www.aw.com/cseng/titles/0-201-63392-2/code/rwlock.c
Doh! ;)
> as well as the other examples in the book, at
> http://cseng.aw.com/bookdetail.qry?ISBN=0-201-63392-2&ptype=1482
>
> The code implements reader preference, but Butenhof says (about the
> rwl_readlock function) that it can be changed to writer preference by
> blocking "while there are waiting writers (w_wait > 0), not merely
> while there are active writers, as we do here".
It's a nice and straightforward implementation, and it's about equivalent
to what LinuxThreads has now. It doesn't support recursive read locks.
Rather, that is to say, if writer preference is supported in the suggested
way, then it won't support recursive read locks.
I like how he splits up the unlock operation into a read unlock and write
unlock. The caller should know what type of lock it placed, after all.