Walter is right about transitive readonly - here's the alternative

Sean Kelly sean at f4.ca
Thu Sep 13 13:57:23 PDT 2007


Steven Schveighoffer wrote:
> "Sean Kelly" wrote
>>> My implementation wasn't re-entrant for write locks. I never found it
>>> necessary. That said, I know that it is possible to make re-entrant
>>> write locks, but probably not by the means that you suggest.
>> It's possible but to do so I think you'd have to maintain a list of which 
>> threads held which lock.  This doesn't seem terribly efficient, and just 
>> not worthwhile for something that is of marginal utility.
> 
> Since write-lock is exclusive, you only need to know a single thread which 
> holds the lock.  The thread ID can be stored with the lock, so it is easy to 
> tell/efficient.

Hm, good point.  I guess the only complicated bit is upgrading a read 
lock to a write lock, but that's a separate issue.


Sean



More information about the Digitalmars-d mailing list