private static void ConsumeItem() { using (TextWriter w = new StreamWriter(_logFileName, true)) { while (tellConsumerToConsume.WaitOne()) { for (int i = 0; i < _newMessageCount; i++) { LogMsg m = _messageWriteBuffer[i]; m.WriteWith((StreamWriter)w); } w.Flush(); } } }