| | |
| | | import ( |
| | | "context" |
| | | "fmt" |
| | | "github.com/gen2brain/shm" |
| | | shm "basic.com/valib/goshm.git" |
| | | "reflect" |
| | | "runtime" |
| | | "sync/atomic" |
| | |
| | | ) |
| | | |
| | | const ( |
| | | TimePeriodPutOrGet = time.Duration(5) * time.Microsecond |
| | | TimePeriodPutOrGet = time.Duration(5)*time.Millisecond //ms |
| | | ) |
| | | |
| | | //Element info |
| | |
| | | } |
| | | |
| | | //todo |
| | | if posCnt >= capMod-1 { |
| | | //if posCnt >= capMod { |
| | | //if posCnt >= capMod-1 { |
| | | if posCnt >= capMod { |
| | | runtime.Gosched() |
| | | return false, int(posCnt) |
| | | } |
| | |
| | | |
| | | cache = &(eqi.EsCaches[putPosNew&capMod]) |
| | | |
| | | //tryMax := 100 |
| | | //tryCount := 0 |
| | | for { |
| | | getNo := atomic.LoadUint32(&cache.getNo) |
| | | putNo := atomic.LoadUint32(&cache.putNo) |
| | |
| | | } else { |
| | | runtime.Gosched() |
| | | } |
| | | //tryCount++ |
| | | //if tryCount >= tryMax { |
| | | // return false, int(posCnt) |
| | | //} |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | cache = &(eqi.EsCaches[getPosNew&capMod]) |
| | | |
| | | //tryMax := 100 |
| | | //tryCount := 0 |
| | | for { |
| | | getNo := atomic.LoadUint32(&cache.getNo) |
| | | putNo := atomic.LoadUint32(&cache.putNo) |
| | |
| | | } else { |
| | | runtime.Gosched() |
| | | } |
| | | //tryCount++ |
| | | //if tryCount >= tryMax { |
| | | // return ElemInfo{}, false, int(posCnt) |
| | | //} |
| | | } |
| | | } |
| | | |