]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Declare asyncCount volatile since it is accessed from multiple threads 31/1131/1
authorJussi Koskela <jussi.koskela@semantum.fi>
Fri, 20 Oct 2017 06:11:13 +0000 (09:11 +0300)
committerJussi Koskela <jussi.koskela@semantum.fi>
Fri, 20 Oct 2017 06:11:13 +0000 (09:11 +0300)
refs #7565

Change-Id: Ibea9155356882beb74e330ec8ed8b03bee3cbb15

bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java

index 5adc593001cd19ae305c5fb3e00dfe181b0003e0..f30418a6a32869bf009fc661baa47244a4679a1b 100644 (file)
@@ -47,7 +47,7 @@ class State {
     private volatile int readCount = 0; // Must be volatile so we don't have to synchronize getReadCount.
     private volatile int writeCount = 0; // Must be volatile so we don't have to synchronize getWriteCount.
     private Thread            writeOwner       = null;
     private volatile int readCount = 0; // Must be volatile so we don't have to synchronize getReadCount.
     private volatile int writeCount = 0; // Must be volatile so we don't have to synchronize getWriteCount.
     private Thread            writeOwner       = null;
-    private int               asyncCount       = 1;
+    private volatile int asyncCount = 1; // Must be volatile so we don't have to synchronize getAsyncCount.
     private TransactionToken  transactionToken = null;
     void setCombine(boolean a) {
         if (null != transactionToken)
     private TransactionToken  transactionToken = null;
     void setCombine(boolean a) {
         if (null != transactionToken)