-
Notifications
You must be signed in to change notification settings - Fork 485
Description
I've been reading 'Lock' and its lone implementation 'SlimReadWriteLock'.
There is something scary to me about the idea of a Lock class API with operations like 'ForReading', 'ForWriting', 'ForReadingUpgradable' where it will return you a holder of the lock, which I think implies that you own the lock and will thereby release it by Disposing the holder, but that only optionally waits to acquire the lock first (since it has an overload with a (bool waitForLock) signature.
I guess the intention here was that we're going to be able to use this Lock class to write some very optimal code where we don't wait for the lock if we know we already acquired it, or something clever like that right?
Well you may or may not be surprised to learn I could find no such extremely clever code anywhere in Castle.Core... in fact it seems that waitForLock is ALWAYS true. So I was scared for nothing.
So really this issue is just to point out this seems like a great opportunity for some YAGNI-aligned code simplification...