From 4bec61fa5a3aa6e025618552ab94876d6b5a712a Mon Sep 17 00:00:00 2001 From: chenshijun <chenshijun@aiotlink.com> Date: 星期三, 22 四月 2020 11:18:45 +0800 Subject: [PATCH] 把延时单位修正成毫秒 --- shmqueue.go | 18 +++--------------- 1 files changed, 3 insertions(+), 15 deletions(-) diff --git a/shmqueue.go b/shmqueue.go index bf6dcfd..227ee4a 100644 --- a/shmqueue.go +++ b/shmqueue.go @@ -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) - //} } } -- Gitblit v1.8.0