Read/Write locks that can be changed into each other?

From: Henrik Theiling (
Date: Mon Apr 24 2000 - 15:13:36 EST


Somewhere I read that it would be no problem to add read-locks that
can be upgraded to write-locks. I'd like to have such locks. I'd
also like to use the other direction.

In an interrupt, I have the following situation:
   a) read a register, possibly decide to leave interrupt, if not,
   b) write some registers, and then
   c) some lengthy reading and checking of some registers.

Currently, I use spin-locks and only lock part b), because a) is
atomic and cannot be disturbed by another write. But c) might not
like writing, I have to think about that thouroughly. However, it is
quiet a lengthy checking procedure in an interrupt that occurs
periodically every 1.333ms (on a sound card). I'd really like to
unlock as early as possible. Using a write->read lock demotion would
be perfect.

So the thing that would be nice is a read-lock that can be promoted to
be a write-lock and then demoted again to be a read-lock before
unlocking completely.


[-- -- --]
[-- Saarland University -- Bau 45 R 429 -- +49 681 8318304 --]
[-- 0x9E314CA5 FA 1C 02 C9 58 04 57 6E 53 9C DF 94 B4 45 AE 24 --]

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:08 EST