/*
 * Register entry for cleanup. When the clients ends, all the entries still
 * in the lists are released to the cache
 *
 * This is done to ensure all entries are released to the cache even if the
 * client throws an exception
 *
 */
static void
Cache_RegisterCleanup(Cache *cache, CacheEntry *entry, bool isCachedEntry)
{
	Assert(NULL != cache);
	Assert(NULL != entry);

	MemoryContext oldcxt = MemoryContextSwitchTo(TopMemoryContext);
	DLAddHead(cache->ownedEntries, DLNewElem(entry));
	MemoryContextSwitchTo(oldcxt);
}
Exemple #2
0
void
PQappendNotify(char *relname, int pid)
{
    PQNotifyList *p;
    
    if (pqNotifyList == NULL) 
	pqNotifyList = DLNewList();
    
    p = (PQNotifyList*)pbuf_alloc(sizeof(PQNotifyList));
    strncpy(p->relname, relname, NAMEDATALEN);
    p->be_pid = pid;
    p->valid = 1;
    DLAddTail(pqNotifyList, DLNewElem(p));
}