| | |
| | | |
| | | cache = &(eqi.EsCaches[putPosNew&capMod]) |
| | | |
| | | tryMax := 100 |
| | | tryCount := 0 |
| | | for { |
| | | getNo := atomic.LoadUint32(&cache.getNo) |
| | | putNo := atomic.LoadUint32(&cache.putNo) |
| | |
| | | return true, int(posCnt + 1) |
| | | } else { |
| | | runtime.Gosched() |
| | | } |
| | | tryCount++ |
| | | if tryCount >= tryMax { |
| | | fmt.Println("Put tryCount:", tryCount) |
| | | 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 { |
| | | fmt.Println("Get tryCount:", tryCount) |
| | | return ElemInfo{}, false, int(posCnt) |
| | | } |
| | | } |
| | | } |
| | | |