chenshijun
2020-06-04 47a19e070f57d92aadf52c62361da6ab5397bd4c
shmqueue.go
@@ -3,7 +3,7 @@
import (
   "context"
   "fmt"
   "github.com/gen2brain/shm"
   shm "basic.com/valib/goshm.git"
   "reflect"
   "runtime"
   "sync/atomic"
@@ -12,7 +12,7 @@
)
const (
   TimePeriodPutOrGet = time.Duration(5) * time.Microsecond
   TimePeriodPutOrGet = time.Duration(5)*time.Millisecond //ms
)
//Element info
@@ -189,8 +189,8 @@
   }
   //todo
   if posCnt >= capMod-1 {
   //if posCnt >= capMod {
   //if posCnt >= capMod-1 {
   if posCnt >= capMod {
      runtime.Gosched()
      return false, int(posCnt)
   }
@@ -204,8 +204,6 @@
   cache = &(eqi.EsCaches[putPosNew&capMod])
   //tryMax := 100
   //tryCount := 0
   for {
      getNo := atomic.LoadUint32(&cache.getNo)
      putNo := atomic.LoadUint32(&cache.putNo)
@@ -216,10 +214,6 @@
      } else {
         runtime.Gosched()
      }
      //tryCount++
      //if tryCount >= tryMax {
      //   return false, int(posCnt)
      //}
   }
}
@@ -301,8 +295,6 @@
   cache = &(eqi.EsCaches[getPosNew&capMod])
   //tryMax := 100
   //tryCount := 0
   for {
      getNo := atomic.LoadUint32(&cache.getNo)
      putNo := atomic.LoadUint32(&cache.putNo)
@@ -314,10 +306,6 @@
      } else {
         runtime.Gosched()
      }
      //tryCount++
      //if tryCount >= tryMax {
      //   return ElemInfo{}, false, int(posCnt)
      //}
   }
}