• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ pool_destroy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pool_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ pool_destroy函数的具体用法?C++ pool_destroy怎么用?C++ pool_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pool_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: fopen

config_t *load_config(pool_t *proc, const char *conf_path) {
	char *line = NULL;
	size_t len = 0;
	int rv;
	pool_t *tmp_pool;
	config_t *conf;

	FILE *fp = fopen(conf_path, "r");
	if (!fp) {
		fprintf(stderr, "Unable to open config file %s. Error %s", conf_path, strerror(errno));
		return NULL;
	}

	tmp_pool = pool_create(proc, "temporary config pool");
	conf = pool_alloc(proc, sizeof(*conf), "config object");

	/* format is A=B\n. Lines starting with # are comments. Empty lines are allowed. WS is allowed */
	while ((rv = readline(tmp_pool, &line, fp)) > 0) {
		char *l = line;
		while (isspace(*l)) l++;
		if ((l[0] != '#') && (l[0] != '\0'))  {
			process_config_line(proc, conf, l); 
		}
	}
	if (!feof(fp)) {
		fprintf(stderr, "Error while reading config file %s. Error %s", conf_path, strerror(ferror(fp)));
		pool_destroy(tmp_pool);
		return NULL;
	}
	pool_destroy(tmp_pool);
	return conf;
}
开发者ID:Krabby127,项目名称:misc,代码行数:32,代码来源:config.c


示例2: profile_palloc_single_chars

static unsigned long long
profile_palloc_single_chars(const unsigned long iterations)
{
    struct timeval start;
    struct timeval stop;

    pool_reference char_ref_pool = pool_create(CHAR_REF_TYPE_ID);
    pool_reference char_pool = pool_create(CHAR_TYPE_ID);

    pool_grow(&char_ref_pool, iterations);
    
    global_reference *char_refs = pool_to_array(char_ref_pool);

    gettimeofday(&start, NULL);
    for (unsigned long i = 0 ; i < iterations ; ++i) {
        char_refs[i] = pool_alloc(&char_pool);
    }
    gettimeofday(&stop, NULL);

    pool_destroy(&char_ref_pool);
    pool_destroy(&char_pool);

    return ((stop.tv_sec - start.tv_sec) * 1000000LLU) +
            stop.tv_usec - start.tv_usec; 
}
开发者ID:jupvfranco,项目名称:ohmm,代码行数:25,代码来源:alloc_benchmark.c


示例3: t_field_map

void
t_field_map(void)
{
    pool_reference list_pool = pool_create(LIST_TYPE_ID);
    CU_ASSERT_NOT_EQUAL_FATAL(list_pool, NULL_POOL);

    global_reference head = pool_alloc(&list_pool);
    pool_iterator itr = iterator_new(&list_pool, &head);

    size_t list_size = 10000;

    for (size_t i = 0 ; i < list_size ; ++i) {
        iterator_set_field(itr, 1, &i);
        iterator_list_insert(itr, pool_alloc(&list_pool));
        itr = iterator_next(list_pool, itr);
    }

    pool_reference long_pool = pool_create(LONG_TYPE_ID);
    CU_ASSERT_NOT_EQUAL_FATAL(long_pool, NULL_POOL);

    CU_ASSERT_EQUAL(field_map(list_pool, &long_pool, 1, square), 0);

    uint64_t *result = pool_to_array(long_pool);

    int cmp_error_count = 0;
    for (size_t i = 0 ; i < list_size ; ++i) {
        cmp_error_count += i*i != result[i];
    }

    CU_ASSERT_EQUAL(cmp_error_count, 0);

    iterator_destroy(&itr);
    pool_destroy(&long_pool);
    pool_destroy(&list_pool);
}
开发者ID:jupvfranco,项目名称:ohmm,代码行数:35,代码来源:test_pool_map.c


示例4: hashtable_destroy

/**
 * @brief Dispose of a hash table
 *
 * This function deletes all the entries from the given hash table and
 * then destroys the hash table.
 *
 * @param[in,out] ht        Pointer to the hash table.  After calling
 *                          this function, the memory pointed to by ht
 *                          must not be accessed in any way.
 * @param[in]     free_func Function to free entries as they are
 *                          deleted
 *
 * @return HASHTABLE_SUCCESS on success, other things on failure
 */
hash_error_t
hashtable_destroy(struct hash_table *ht,
		  int (*free_func)(struct gsh_buffdesc,
				   struct gsh_buffdesc))
{
	size_t index = 0;
	hash_error_t hrc = HASHTABLE_SUCCESS;

	hrc = hashtable_delall(ht, free_func);
	if (hrc != HASHTABLE_SUCCESS)
		goto out;

	for (index = 0; index < ht->parameter.index_size; ++index) {
		if (ht->partitions[index].cache) {
			gsh_free(ht->partitions[index].cache);
			ht->partitions[index].cache = NULL;
		}

		PTHREAD_RWLOCK_destroy(&(ht->partitions[index].lock));
	}
	pool_destroy(ht->node_pool);
	pool_destroy(ht->data_pool);
	gsh_free(ht);

 out:
	return hrc;
}
开发者ID:srimalik,项目名称:nfs-ganesha,代码行数:41,代码来源:hashtable.c


示例5: nfs_node_done

/*
 * Free resources previously allocated in nfs_node_reinit().
 */
void
nfs_node_done(void)
{

	pool_destroy(&nfs_node_pool);
	pool_destroy(&nfs_vattr_pool);
	workqueue_destroy(nfs_sillyworkq);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:11,代码来源:nfs_node.c


示例6: ext2fs_done

void
ext2fs_done(void)
{

	ufs_done();
	pool_destroy(&ext2fs_inode_pool);
	pool_destroy(&ext2fs_dinode_pool);
}
开发者ID:Hooman3,项目名称:minix,代码行数:8,代码来源:ext2fs_vfsops.c


示例7: scene_destroy

void scene_destroy(Scene* scene) {
    cpSpaceFree(scene->space);

    // entities has to be first, because of relation with components
    pool_destroy(scene->entities);
    pool_destroy(scene->transforms);
    pool_destroy(scene->scripts);
    pool_destroy(scene->sprites);
    free(scene);
}
开发者ID:ifzz,项目名称:merriment,代码行数:10,代码来源:scene.c


示例8: bacstack_session_destroy

int bacstack_session_destroy(bacstack_session_t *session)
{
  return 1 
      && rwlock_destroy(&session->routetable_lock)
      && bacstack_routetable_destroy(&session->routetable)
      && pool_destroy(&session->message_pool)
      && pool_destroy(&session->proc_pool)
      && bacdl_server_destroy(&session->dl_server)
      && thread_destroy(&session->msg_proc_thread)
      && thread_destroy(&session->dl_accept_thread)
      && thread_destroy(&session->dl_receive_thread);
}
开发者ID:isosphere-contributions,项目名称:bacstack,代码行数:12,代码来源:session.c


示例9: glw_fini

void
glw_fini(glw_root_t *gr)
{
  glw_text_bitmap_fini(gr);
  rstr_release(gr->gr_default_font);
  glw_tex_fini(gr);
  free(gr->gr_skin);
  glw_fini_settings(gr);
  pool_destroy(gr->gr_token_pool);
  pool_destroy(gr->gr_clone_pool);
  prop_courier_destroy(gr->gr_courier);
  hts_mutex_destroy(&gr->gr_mutex);
}
开发者ID:Allba,项目名称:showtime,代码行数:13,代码来源:glw.c


示例10: upload_speed

void upload_speed(char* dest_server_ip,char* interface_name,char* vist_domain)
{
	int i;
	int loop = HTTP_SEND_NUM;
	struct download_post_info info[HTTP_SEND_NUM];
	/*delay time */
	struct timeval starttime,endtime;
	
	/*fill struct for post */
	for(i=0;i<loop;i++){
		fill_upload_request(info[i].post_string,vist_domain);
		strncpy(info[i].server_ip,dest_server_ip,IPV4_SIZE);
		strncpy(info[i].interface,interface_name,MAX_NAME_LEN);
	}
	
	gettimeofday(&starttime,0);
	for(i=0;i<loop;i++){
		pool_add_worker(file_upload,&info[i]); 
	}
	while(1){ 
		usleep(1000);
		//IK_APP_DEBUG_LOG("pool->cur_queue_size == %d\n",pool->cur_queue_size);
		if(pool->cur_queue_size == 0){
			pool_destroy();
			gettimeofday(&endtime,0);
			double timeuse = (1000000*(endtime.tv_sec - starttime.tv_sec) + endtime.tv_usec - starttime.tv_usec)/1000000;
			double result = (sum_send_lens / timeuse / (1024 * 1024));
			printf("sum_lens: %lld byte | time_use: %f s | speed : %.2fMB\n",sum_send_lens,timeuse,result);
			break;
		}
	}
}
开发者ID:liqwalex,项目名称:testgit,代码行数:32,代码来源:ik_speed_test.c


示例11: HacheTableDestroy

/*
 * Deallocates a HacheTable object (created by HacheTableCreate).
 *
 * The deallocate_data parameter is a boolean to indicate whether the
 * data attached to the hash table should also be free()d. DO NOT USE
 * this if the HacheData attached was not a pointer allocated using
 * malloc().
 */
void HacheTableDestroy(HacheTable *h, int deallocate_data) {
    int i;

    if (!h)
	return;

    //HacheTableRefInfo(h, stdout);

    for (i = 0; i < h->nbuckets; i++) {
	HacheItem *hi = h->bucket[i], *next = NULL;
	for (hi = h->bucket[i]; hi; hi = next) {
	    assert(hi->h == h);
	    next = hi->next;
	    HacheItemDestroy(h, hi, deallocate_data);
	}
    }
    
    if (h->hi_pool) pool_destroy(h->hi_pool);

    if (h->bucket)
	free(h->bucket);

    if (h->ordering)
	free(h->ordering);

    free(h);
}
开发者ID:nathanhaigh,项目名称:staden-trunk,代码行数:35,代码来源:hache_table.c


示例12: Shutdown

static void Shutdown()
{
	debug_printf(L"H_MGR| shutdown. any handle frees after this are leaks!\n");
	// objects that store handles to other objects are destroyed before their
	// children, so the subsequent forced destruction of the child here will
	// raise a double-free warning unless we ignore it. (#860, #915, #920)
	ignoreDoubleFree = true;

	H_ScopedLock s;

	// forcibly close all open handles
	for(HDATA* hd = (HDATA*)hpool.da.base; hd < (HDATA*)(hpool.da.base + hpool.da.pos); hd = (HDATA*)(uintptr_t(hd)+hpool.el_size))
	{
		// it's already been freed; don't free again so that this
		// doesn't look like an error.
		if(hd->key == 0)
			continue;

		// disable caching; we need to release the resource now.
		hd->keep_open = 0;
		hd->refs = 0;

		h_free_hd(hd);
	}

	pool_destroy(&hpool);
}
开发者ID:Gallaecio,项目名称:0ad,代码行数:27,代码来源:h_mgr.cpp


示例13: test_getset_parameter_node_value

static void test_getset_parameter_node_value (abts_case *tc, void *data)
{
    cwmp_t * c = (cwmp_t*)data;

    parameter_node_t * param;
    char * name = "InternetGatewayDevice.DeviceInfo.SoftwareVersion";
    char * retval;
    char * value ;
    
    pool_t * pool = pool_create(POOL_DEFAULT_SIZE);
    FUNCTION_TRACE();
    param = cwmp_get_parameter_path_node(c->root, name);
    ASSERT_NOTNULL(param);
    
    value = "V1.3.x";

    cwmp_set_parameter_node_value(c, param, name, value, strlen(value));
    
    retval = cwmp_data_get_parameter_value(c, param, name, pool);
    printf("retval ------------------is %s\n", retval);
    ASSERT_STR_EQ(value, retval);
   
    
    value = "V1.4.x";
    cwmp_set_parameter_node_value(c, param, name, value, strlen(value));
    retval = cwmp_data_get_parameter_value(c, param, name, pool);
    ASSERT_STR_EQ(value, retval);
    
    
    pool_destroy(pool);

}
开发者ID:HankMa,项目名称:netcwmp,代码行数:32,代码来源:test_rpc.c


示例14: handle_request_socket

void handle_request_socket(http_conf *g , struct epoll_event *evfd ) {

	epoll_extra_data_t * epoll_data = (epoll_extra_data_t *)evfd->data.ptr;

	http_connect_t *con = (http_connect_t *) epoll_data->ptr;

	if(con->in == NULL) {
		//accept_handler(g, con, evfd);
		epoll_edit_fd(g->epfd, evfd, EPOLL_W);
		return ;
		//epoll_del_fd(g->epfd, evfd);
	}
	while(con->next_handle != NULL) {
		int ret = con->next_handle(con);
		if(ret == DONE) {
			if(con->in->execute_file != NULL && con->in->execute_file->len > 0) {
				char *shPath = (char *)palloc(con->p, sizeof(char)*con->in->execute_file->len +1);
				strncpy(shPath, con->in->execute_file->ptr, con->in->execute_file->len);
				ds_log(con, " [send execute sh command:]", LOG_LEVEL_DEFAULT);
				send_execute_sh_cmd(con, g);
			}
			con->next_handle = NULL;
			epoll_del_fd(g->epfd, evfd);
			close(con->fd);
			ds_log(con, "  [END] ", LOG_LEVEL_DEFAULT);
			pool_destroy(con->p);
			//handle_request_destory(g, evfd);
		}else if(ret == CONTINUE) {
			break;
		}
	}
}
开发者ID:rentiansheng,项目名称:devSync,代码行数:32,代码来源:http_request.c


示例15: TestEntries

static void TestEntries()
{
    const int SZ = 4;
    const int ALGN = 4;
    size_t size[SZ] = {8, 8000, 9000, 100*1024};
    size_t algn[ALGN] = {8, 64, 4*1024, 8*1024*1024};

    rml::MemPoolPolicy pol(getGranMem, putGranMem);
    currGranularity = 1; // not check granularity in the test
    rml::MemoryPool *pool;

    pool_create_v1(0, &pol, &pool);
    for (int i=0; i<SZ; i++)
        for (int j=0; j<ALGN; j++) {
            char *p = (char*)pool_aligned_malloc(pool, size[i], algn[j]);
            ASSERT(p && 0==((uintptr_t)p & (algn[j]-1)), NULL);
            memset(p, j, size[i]);

            size_t curr_algn = algn[rand() % ALGN];
            size_t curr_sz = size[rand() % SZ];
            char *p1 = (char*)pool_aligned_realloc(pool, p, curr_sz, curr_algn);
            ASSERT(p1 && 0==((uintptr_t)p1 & (curr_algn-1)), NULL);
            ASSERT(memEqual(p1, min(size[i], curr_sz), j), NULL);

            memset(p1, j+1, curr_sz);
            size_t curr_sz1 = size[rand() % SZ];
            char *p2 = (char*)pool_realloc(pool, p1, curr_sz1);
            ASSERT(p2, NULL);
            ASSERT(memEqual(p2, min(curr_sz1, curr_sz), j+1), NULL);

            pool_free(pool, p2);
        }

    pool_destroy(pool);
}
开发者ID:AlessioVallero,项目名称:RaspberryPI,代码行数:35,代码来源:test_malloc_pools.cpp


示例16: module_remove

/******************************************************************
 *		module_remove
 *
 */
BOOL module_remove(struct process* pcs, struct module* module)
{
    struct module**     p;

    TRACE("%s (%p)\n", module->module.ModuleName, module);
    hash_table_destroy(&module->ht_symbols);
    hash_table_destroy(&module->ht_types);
    HeapFree(GetProcessHeap(), 0, (char*)module->sources);
    HeapFree(GetProcessHeap(), 0, module->addr_sorttab);
    pool_destroy(&module->pool);
    /* native dbghelp doesn't invoke registered callback(,CBA_SYMBOLS_UNLOADED,) here
     * so do we
     */
    for (p = &pcs->lmodules; *p; p = &(*p)->next)
    {
        if (*p == module)
        {
            *p = module->next;
            HeapFree(GetProcessHeap(), 0, module);
            return TRUE;
        }
    }
    FIXME("This shouldn't happen\n");
    return FALSE;
}
开发者ID:howard5888,项目名称:wineT,代码行数:29,代码来源:module.c


示例17: session_free

NSAPI_PUBLIC void session_free(Session *sn)
{
    NSAPISession *nsn = (NSAPISession *) sn;

    // If this session was cloned,
    // Remove any filters that were installed during this session
    if (nsn->session_clone && sn->csd && sn->csd_open)
        filter_finish_response(sn);

    INTsession_cleanup(sn);
    if (sn->inbuf)
      netbuf_close(sn->inbuf);

    if (nsn->session_clone) {
        if (sn->csd && sn->csd_open)
            PR_Close(sn->csd);
        sn->csd = NULL;
        sn->csd_open = 0;

        pool_free(sn->pool, sn);
    } else {
        systhread_setdata(getThreadMallocKey(), NULL);
        pool_destroy(sn->pool);

        PERM_FREE(sn);
    }
}
开发者ID:OldsSourcesBackups,项目名称:Heliod-Web-Server,代码行数:27,代码来源:session.cpp


示例18: udf_discstrat_finish_seq

static void
udf_discstrat_finish_seq(struct udf_strat_args *args)
{
	struct udf_mount *ump = args->ump;
	struct strat_private *priv = PRIV(ump);
	int error;

	if (ump == NULL)
		return;

	/* stop our sheduling thread */
	KASSERT(priv->run_thread == 1);
	priv->run_thread = 0;
	wakeup(priv->queue_lwp);
	do {
		error = tsleep(&priv->run_thread, PRIBIO+1,
			"udfshedfin", hz);
	} while (error);
	/* kthread should be finished now */

	/* set back old device strategy method */
	VOP_IOCTL(ump->devvp, DIOCSSTRATEGY, &priv->old_strategy_setting,
			FWRITE, NOCRED);

	/* destroy our pool */
	pool_destroy(&priv->desc_pool);

	mutex_destroy(&priv->discstrat_mutex);
	cv_destroy(&priv->discstrat_cv);

	/* free our private space */
	free(ump->strategy_private, M_UDFTEMP);
	ump->strategy_private = NULL;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:34,代码来源:udf_strat_sequential.c


示例19: module_remove

/******************************************************************
 *		module_remove
 *
 */
BOOL module_remove(struct process* pcs, struct module* module)
{
    struct module_format*modfmt;
    struct module**     p;
    unsigned            i;

    TRACE("%s (%p)\n", debugstr_w(module->module.ModuleName), module);

    for (i = 0; i < DFI_LAST; i++)
    {
        if ((modfmt = module->format_info[i]) && modfmt->remove)
            modfmt->remove(pcs, module->format_info[i]);
    }
    hash_table_destroy(&module->ht_symbols);
    hash_table_destroy(&module->ht_types);
    wine_rb_destroy(&module->sources_offsets_tree, NULL, NULL);
    HeapFree(GetProcessHeap(), 0, module->sources);
    HeapFree(GetProcessHeap(), 0, module->addr_sorttab);
    pool_destroy(&module->pool);
    /* native dbghelp doesn't invoke registered callback(,CBA_SYMBOLS_UNLOADED,) here
     * so do we
     */
    for (p = &pcs->lmodules; *p; p = &(*p)->next)
    {
        if (*p == module)
        {
            *p = module->next;
            HeapFree(GetProcessHeap(), 0, module);
            return TRUE;
        }
    }
    FIXME("This shouldn't happen\n");
    return FALSE;
}
开发者ID:alu3177,项目名称:-LDH-Pract4,代码行数:38,代码来源:module.c


示例20: test_basic

static void test_basic(void)
{
  int i;
  void *start = NULL;
  void *item;
  pool *p = pool_new(100, 10);

  /* get all items */
  for (i=0; i < 10; i++) {
    item = pool_get(p);
    if (!i)
      start = item;
    assert(item);
  }

  assert(pool_get(p) == NULL);

  /* put all items */
  for (i=0; i < 10; i++) {
    void *t = (void *)((char *)start + (i * 10));
    pool_put(p, t);
  }

  /* get them back */
  for (i=0; i < 10; i++)
    assert(pool_get(p));

  pool_destroy(p);
}
开发者ID:rgs1,项目名称:libsmall,代码行数:29,代码来源:test-pool.c



注:本文中的pool_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pool_free函数代码示例发布时间:2022-05-31
下一篇:
C++ pnp_get_drvdata函数代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap