Serialize access to debug.log stream
authorMichael Hendricks <michael@ndrix.org>
Fri, 2 Mar 2012 19:24:38 +0000 (12:24 -0700)
committerLuke Dashjr <luke-jr+git@utopios.org>
Wed, 6 Jun 2012 19:29:28 +0000 (19:29 +0000)
commita0ea95d3ceacea5868b8f921c36bbdddb5dc2b1b
tree259f8058484ae446ae34df46eb7f010e75f16cbc
parent82a227b263fa7d4caee454884661548f7415b9d7
Serialize access to debug.log stream

Acquire an exclusive, advisory lock before sending output to debug.log
and release it when we're done. This should avoid output from multiple
threads being interspersed in the log file.

We can't use CRITICAL_SECTION machinery for this because the debug log
is written during startup and shutdown when that machinery is not
available.

(Thanks to Gavin for pointing out the CRITICAL_SECTION problems based
on his earlier work in this area)
src/util.cpp