Lucene.Net.Core.Util.PrintStreamInfoStream: Changed back to original implementation that uses AtomicInt32 rather than Interlocked, fixing a bug in the process
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d9f979c1 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d9f979c1 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d9f979c1 Branch: refs/heads/api-work Commit: d9f979c1f65ef04d6f98045cae6f4ff81ef33073 Parents: cccf0c5 Author: Shad Storhaug <[email protected]> Authored: Thu Mar 23 23:04:15 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 23 23:04:15 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d9f979c1/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs b/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs index 7a171d6..ba473db 100644 --- a/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs +++ b/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs @@ -1,3 +1,4 @@ +using Lucene.Net.Support; using System; using System.IO; using System.Threading; @@ -30,14 +31,14 @@ namespace Lucene.Net.Util public class PrintStreamInfoStream : InfoStream { // Used for printing messages - private static int MESSAGE_ID = 0; + private static readonly AtomicInt32 MESSAGE_ID = new AtomicInt32(); protected readonly int m_messageID; protected readonly TextWriter m_stream; public PrintStreamInfoStream(TextWriter stream) - : this(stream, Interlocked.Increment(ref MESSAGE_ID)) + : this(stream, MESSAGE_ID.GetAndIncrement()) { }
