stuff i do at work

(maybe i’ll make less mistakes if i remember some)

Archive for August, 2008

Reader/writer locks and favoritism

Posted by noah on August 20, 2008

Something that I never really considered when using an implementation of reader/writer locks is whether it favors readers, writers, or tries to take a balanced approach. I waited to use this feature in .net until recently since the basic reader/writer was implemented poorly

So 3.5 has ReaderWriterLockSlim, which is really handy, except in my case, it doesn’t work the way I want it to.  I’m writing a quote server which requires high read availability.  After I implemented ReaderWriterLockSlim, I couldn’t get a read lock in some cases when there was only one other read lock.  Turns out that I had one other request for a writer lock pending, which blocked the 2nd read lock. 

I read this in the documentation, but I guess it just didn’t click at that time.

minus 10 points for me (and minus 3 hours of my life)

Posted in Uncategorized | Leave a Comment »