3 ms·
> Watch out for ReaderWriterLockSlim. Yes. And if you register this in a using-statement thinking it will be disposed, you may encounter a edge case where the
by josteink 13y ago
> Watch out for ReaderWriterLockSlim.
Yes.
And if you register this in a using-statement thinking it will be disposed, you may encounter a edge case where the lock has been created, but not assigned and thus wont get disposed and you will have orphaned locks jamming up your system.
Where I worked, we had complete system crashes which could be traced back to "incorrect" usage of this very class[1]. It only happened in production, it was hell to debug, and we had to use more low-level tools than I ever thought should be needed for .NET code.
We replaced it with a traditional lock {} and never looked back.
[1] "Incorrect" as in not having around 50 lines of boilerplate which has to be tediously and 100% correctly done, on a per lock-invocation basis, since generalizing the implementation will ruin its correctness.
- Pxtl 13y ago> Where I worked, we had complete system crashes which could be traced back "incorrect" usage of this very class Ah, yes. The ultimate abstraction failure - a bad library is one that requires you not only understand its abstraction, but you understand its implementation and the underlying layer in such meticulous detail that you could re-write the entire thing from scratch. See also webforms. Worse than useless.