chenshijun
2020-04-15 b45e986f51e4545a9f42e6f387829a75d589c69a
shmqueue.go
@@ -210,6 +210,8 @@
   cache = &(eqi.EsCaches[putPosNew&capMod])
   tryMax := 100
   tryCount := 0
   for {
      getNo := atomic.LoadUint32(&cache.getNo)
      putNo := atomic.LoadUint32(&cache.putNo)
@@ -219,6 +221,11 @@
         return true, int(posCnt + 1)
      } else {
         runtime.Gosched()
      }
      tryCount++
      if tryCount >= tryMax {
         fmt.Println("Put tryCount:", tryCount)
         return false, int(posCnt)
      }
   }
}
@@ -302,6 +309,8 @@
   cache = &(eqi.EsCaches[getPosNew&capMod])
   tryMax := 100
   tryCount := 0
   for {
      getNo := atomic.LoadUint32(&cache.getNo)
      putNo := atomic.LoadUint32(&cache.putNo)
@@ -313,6 +322,11 @@
      } else {
         runtime.Gosched()
      }
      tryCount++
      if tryCount >= tryMax {
         fmt.Println("Get tryCount:", tryCount)
         return ElemInfo{}, false, int(posCnt)
      }
   }
}