ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [02/12] ignite git commit: IGNITE-1346: Minor opto.
Date Wed, 02 Sep 2015 09:43:32 GMT
IGNITE-1346: Minor opto.


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

Branch: refs/heads/ignite-1273
Commit: 465348e161b997ff15fa7a30de300d8997133a8c
Parents: 34ce97b
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Sep 1 16:48:40 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Sep 1 16:48:40 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/GridStripedSpinBusyLock.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/465348e1/modules/core/src/main/java/org/apache/ignite/internal/util/GridStripedSpinBusyLock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridStripedSpinBusyLock.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/GridStripedSpinBusyLock.java
index 614a88f..a11b0b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridStripedSpinBusyLock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridStripedSpinBusyLock.java
@@ -88,18 +88,20 @@ public class GridStripedSpinBusyLock {
      * Block.
      */
     public void block() {
-        boolean interrupt = false;
-
+        // 1. CAS-loop to set a writer bit.
         for (AtomicInteger state : states) {
-            // 1. CAS-loop to set a writer bit.
             while (true) {
                 int oldVal = state.get();
 
                 if (state.compareAndSet(oldVal, oldVal | WRITER_MASK))
                     break;
             }
+        }
 
-            // 2. Wait until all readers are out.
+        // 2. Wait until all readers are out.
+        boolean interrupt = false;
+
+        for (AtomicInteger state : states) {
             while (state.get() != WRITER_MASK) {
                 try {
                     Thread.sleep(10);


Mime
View raw message