lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/6] lucenenet git commit: don't perform logic in Debug.Assert
Date Sat, 09 May 2015 18:46:25 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 95f358e9a -> 37c400392


don't perform logic in Debug.Assert


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/e7381c08
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/e7381c08
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/e7381c08

Branch: refs/heads/master
Commit: e7381c089e15bf363bcc2e962aa15604c139726e
Parents: 792dbad
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Fri May 8 14:42:05 2015 -0400
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Fri May 8 14:42:05 2015 -0400

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/DocumentsWriterStallControl.cs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e7381c08/src/Lucene.Net.Core/Index/DocumentsWriterStallControl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocumentsWriterStallControl.cs b/src/Lucene.Net.Core/Index/DocumentsWriterStallControl.cs
index 0ee948c..6423cdf 100644
--- a/src/Lucene.Net.Core/Index/DocumentsWriterStallControl.cs
+++ b/src/Lucene.Net.Core/Index/DocumentsWriterStallControl.cs
@@ -81,9 +81,13 @@ namespace Lucene.Net.Index
                         // don't loop here, higher level logic will re-stall!
                         try
                         {
-                            Debug.Assert(IncWaiters());
+                            // make sure not to run IncWaiters / DecrWaiters id Debug.Assert
as that gets 
+                            // removed at compile time if built in Release mode
+                            var result = IncWaiters();
+                            Debug.Assert(result);
                             Monitor.Wait(this);
-                            Debug.Assert(DecrWaiters());
+                            result = DecrWaiters();
+                            Debug.Assert(result);
                         }
                         catch (ThreadInterruptedException e)
                         {


Mime
View raw message