| 195 | } |
| 196 | |
| 197 | func insertFuncWrap(data *storeData, callback reflect.Value) int { |
| 198 | var idx int |
| 199 | entry := funcWrapEntry{callback} |
| 200 | if data == nil { |
| 201 | gEngineFuncLock.Lock() |
| 202 | defer gEngineFuncLock.Unlock() |
| 203 | idx = gEngineFuncWrapSlab.allocate() |
| 204 | gEngineFuncWrap[idx] = &entry |
| 205 | idx = (idx << 1) |
| 206 | } else { |
| 207 | idx = len(data.funcWrap) |
| 208 | data.funcWrap = append(data.funcWrap, entry) |
| 209 | idx = (idx << 1) | 1 |
| 210 | } |
| 211 | return idx |
| 212 | } |
| 213 | |
| 214 | func (data *storeData) getFuncWrap(idx int) *funcWrapEntry { |
| 215 | if idx&1 == 0 { |