gaillard/SharpCover — pull request #5 by jcline (2013-09-18 00:40:25+00:00)
Title: Prevent two race conditions around writer

AFAIK, this object isn't threadsafe. Additionally, it's possible for two
threads to assign writer to distinct objects.

In our tests we use a lot of threads. We occasionally experience what appears to be a livelock, but only with instrumented assemblies. We end up using one core at 100% and the test never finishes. I'm unsure if this change fixes the cause of the issue or just happens to prevent it due to the serialization of Count.

A more clever way to deal with the two race conditions would be to add a threadsafe queue which Count enqueued write events to rather than simply writing to the file directly.