func (cache *processArrayCache) LookupPid(pid uint32, evtTs time.Time) (*model.ProcessCacheEntry, bool, error) {
	if pid == 0 || int(pid) > len(cache.entries) {
		return nil, false, fmt.Errorf("(processArrayCache) invalid pid for lookup: %d", pid)
	}
	inCache := false
	var entry *model.ProcessCacheEntry
	for {
		var old *model.ProcessCacheEntry
		entry = cache.entries[pid-1]
		if entry != nil {
			if entry.ExitTime == nil || (evtTs.Before(entry.ExitTime.Add(100 * time.Millisecond))) {
				inCache = entry.IsInCache()
				break
			}
			old = entry
		}
		entry = &model.ProcessCacheEntry{}
		if atomic.CompareAndSwapPointer(
			(*unsafe.Pointer)(unsafe.Pointer(&cache.entries[pid-1])),
			unsafe.Pointer(old),
			unsafe.Pointer(entry)) {
			break
		}
	}
	return entry, inCache, nil
}
// lookupPid - Returns an existing or create the pid's cache entry
Returns an existing or create the pid's cache entry
// lookupPid - Returns an existing or create the pid ' s cache entry
func (cache *processArrayCache) LookupPid(pid uint32, evtTs time.Time) (*model.ProcessCacheEntry, bool, error) {
	if pid == 0 || int(pid) > len(cache.entries) {
		return nil, false, fmt.Errorf("(processArrayCache) invalid pid for lookup: %d", pid)
	}
	inCache := false
	var entry *model.ProcessCacheEntry
	for {
		var old *model.ProcessCacheEntry
		entry = cache.entries[pid-1]
		if entry != nil {
			if entry.ExitTime == nil || (evtTs.Before(entry.ExitTime.Add(100 * time.Millisecond))) {
				inCache = entry.IsInCache()
				break
			}
			old = entry
		}
		entry = &model.ProcessCacheEntry{}
		if atomic.CompareAndSwapPointer(
			(*unsafe.Pointer)(unsafe.Pointer(&cache.entries[pid-1])),
			unsafe.Pointer(old),
			unsafe.Pointer(entry)) {
			break
		}
	}
	return entry, inCache, nil
}
func ( cache * processArrayCache ) LookupPid ( pid uint32 , evtTs time . Time ) ( * model . ProcessCacheEntry , bool , error ) { if pid == 0 || int ( pid ) > len ( cache . entries ) { return nil , false , fmt . Errorf ( " " , pid ) } inCache := false var entry * model . ProcessCacheEntry for { var old * model . ProcessCacheEntry entry = cache . entries [ pid - 1 ] if entry != nil { if entry . ExitTime == nil || ( evtTs . Before ( entry . ExitTime . Add ( 100 * time . Millisecond ) ) ) { inCache = entry . IsInCache ( ) break } old = entry } entry = & model . ProcessCacheEntry { } if atomic . CompareAndSwapPointer ( ( * unsafe . Pointer ) ( unsafe . Pointer ( & cache . entries [ pid - 1 ] ) ) , unsafe . Pointer ( old ) , unsafe . Pointer ( entry ) ) { break } } return entry , inCache , nil }
Returns an existing or create the pid's cache entry
Returns an existing or create the pid ' s cache entry