From 47099312089389a553e8a49f5e2c0739f061b839 Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期一, 30 三月 2020 14:02:58 +0800 Subject: [PATCH] 添加注释 --- shmData.go | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shmData.go b/shmData.go index eca690b..6b3ebf2 100644 --- a/shmData.go +++ b/shmData.go @@ -5,7 +5,7 @@ "unsafe" ) -// lock free queue struct +// []byte struct type ShmDataInfo struct { Capacity uint32 Cache []byte @@ -29,15 +29,15 @@ //WriteShmData data寰呭啓鍏ョ殑鏁版嵁; shmId:鍏变韩鍐呭瓨id,鍙猘ttach,涓峜reate func WriteShmData(data []byte, shmId int) error { - shmdata,err := Attach(shmId) + shmData,err := Attach(shmId) if err != nil { return err } - sdi := shmData2Info(shmdata) - if len(data) <= len(shmdata) { + sdi := shmData2Info(shmData) + if len(data) <= len(shmData) { sdi.Capacity = uint32(len(data)) } else { - sdi.Capacity = uint32(len(shmdata)) + sdi.Capacity = uint32(len(shmData)) } tmpData := ptr2Slice(unsafe.Pointer(&sdi.Cache), int(sdi.Capacity)) @@ -48,12 +48,12 @@ //ReadShmData attach鍒皊hmId瀵瑰簲鐨勫叡浜唴瀛�,骞惰鍑烘暟鎹甗]byte func ReadShmData(shmId int) ([]byte,error) { - shmdata,err := Attach(shmId) + shmData,err := Attach(shmId) if err != nil { return nil,err } - sdi := shmData2Info(shmdata) + sdi := shmData2Info(shmData) tmpData := ptr2Slice(unsafe.Pointer(&sdi.Cache), int(sdi.Capacity)) return tmpData, nil -- Gitblit v1.8.0