lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/5] lucenenet git commit: Interlocked pattern fixes.
Date Wed, 18 Feb 2015 04:24:02 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master f1a2b5046 -> 4b24d4c8c


Interlocked pattern fixes.


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

Branch: refs/heads/master
Commit: bc17a24d8338a950d916f077764da67b6dd175f1
Parents: f1a2b50
Author: Chand2048 <Chand@Microsoft.com>
Authored: Tue Feb 17 14:25:18 2015 -0800
Committer: Chand2048 <Chand@Microsoft.com>
Committed: Tue Feb 17 14:25:18 2015 -0800

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/AtomicInteger.cs                | 7 ++-----
 src/Lucene.Net.Core/Support/AtomicLong.cs                   | 3 +--
 src/Lucene.Net.TestFramework/Randomized/RandomizedRunner.cs | 3 +--
 3 files changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc17a24d/src/Lucene.Net.Core/Support/AtomicInteger.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/AtomicInteger.cs b/src/Lucene.Net.Core/Support/AtomicInteger.cs
index 5f2e9dd..ca8566e 100644
--- a/src/Lucene.Net.Core/Support/AtomicInteger.cs
+++ b/src/Lucene.Net.Core/Support/AtomicInteger.cs
@@ -33,9 +33,7 @@ namespace Lucene.Net.Support
 
         public int GetAndDecrement()
         {
-            int ret = value;
-            Interlocked.Decrement(ref value);
-            return ret;
+            return Interlocked.Decrement(ref value) + 1;
         }
 
         public void Set(int value_)
@@ -45,8 +43,7 @@ namespace Lucene.Net.Support
 
         public int AddAndGet(int value_)
         {
-            Interlocked.Add(ref value, value_);
-            return value;
+            return Interlocked.Add(ref value, value_);
         }
 
         public int Get()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc17a24d/src/Lucene.Net.Core/Support/AtomicLong.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/AtomicLong.cs b/src/Lucene.Net.Core/Support/AtomicLong.cs
index b06cfc9..cabe667 100644
--- a/src/Lucene.Net.Core/Support/AtomicLong.cs
+++ b/src/Lucene.Net.Core/Support/AtomicLong.cs
@@ -33,8 +33,7 @@ namespace Lucene.Net.Support
 
         public long AddAndGet(long value_)
         {
-            Interlocked.Add(ref value, value_);
-            return value;
+            return Interlocked.Add(ref value, value_);
         }
 
         public long Get()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc17a24d/src/Lucene.Net.TestFramework/Randomized/RandomizedRunner.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Randomized/RandomizedRunner.cs b/src/Lucene.Net.TestFramework/Randomized/RandomizedRunner.cs
index f002111..9a1eb22 100644
--- a/src/Lucene.Net.TestFramework/Randomized/RandomizedRunner.cs
+++ b/src/Lucene.Net.TestFramework/Randomized/RandomizedRunner.cs
@@ -57,8 +57,7 @@ namespace Lucene.Net.Randomized
 
         private static int NextSequence()
         {
-            Interlocked.Increment(ref sequence);
-            return sequence;
+            return Interlocked.Increment(ref sequence);
         }
     }
 }
\ No newline at end of file


Mime
View raw message