chenshijun
2020-05-22 309302ff1743e28052a40a640b05b15ec3f58ebd
shmqueue.go
@@ -12,7 +12,7 @@
)
const (
   TimePeriodPutOrGet = time.Duration(5) * time.Microsecond
   TimePeriodPutOrGet = time.Duration(5)*time.Millisecond //ms
)
//Element info
@@ -72,6 +72,9 @@
   shmLen = shmblocks*uint32(unsafe.Sizeof(datainfo)) + uint32(unsafe.Sizeof(shmstruct))
   data, shmid := CreateRawShm(ctx, int(shmLen), key)
   if shmid == -1 {
      return nil
   }
   q := bytes2shmEsQueue(data)
   //init parameters
   q.capacity = shmblocks
@@ -104,6 +107,9 @@
   var eqi EsQueueInfo
   data, shmid := AttachRawShm(ctx, key)
   if shmid == -1 {
      return nil
   }
   shmdata := bytes2shmEsQueue(data)
   eqi.EsCaches = ptr2esCache(unsafe.Pointer(&shmdata.cache), int(shmdata.capacity))
   //fmt.Println("AttachQueue EsCaches:", eqi.EsCaches)