xdbcache xdb_cache(instance id) { xdbcache newx; if(id == NULL) { fprintf(stderr, "Programming Error: xdb_cache() called with NULL\n"); return NULL; } newx = pmalloco(id->p, sizeof(_xdbcache)); newx->i = id; /* flags it as the top of the ring too */ newx->next = newx->prev = newx; /* init ring */ pthread_mutex_init(&(newx->sem),NULL); /* register the handler in the instance to filter out xdb results */ register_phandler(id, o_PRECOND, xdb_results, (void *)newx); /* heartbeat to keep a watchful eye on xdb_cache */ register_beat(10,xdb_thump,(void *)newx); register_shutdown_first(xdb_shutdown, (void *)newx); pool_cleanup(id->p, xdb_shutdown, (void*)newx); return newx; }
xdbcache xdb_cache(instance id) { xdbcache xc; if (id == NULL) { log_alert("xdb", "Programming Error: xdb_cache() called with NULL\n"); return NULL; } xc = pmalloco(id->p, sizeof(_xdbcache)); xc->i = id; /* flags it as the top of the ring too */ xc->first = NULL; /* init ring */ SEM_INIT(xc->sem); /* register the handler in the instance to filter out xdb results */ register_phandler(id, o_PRECOND, xdb_results, (void *) xc); /* heartbeat to keep a watchful eye on xdb_cache */ register_beat(10, xdb_thump, (void *) xc); register_shutdown_first(xdb_shutdown, (void *) xc); return xc; }