当前位置: 首页>>代码示例>>C++>>正文


C++ DESTROY函数代码示例

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


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

示例1: main

int main(int argc, char** argv) {
    lock_t m[2];
    pthread_t alice, bob;

    if (INIT(m)) {
        fprintf(stderr, "Failed to create first mutex.\n");
        return -1;
    }

    if (INIT(m + 1)) {
        fprintf(stderr, "Failed to create second mutex.\n");
        return -1;
    }

    if (pthread_create(&alice, NULL, (void *(*)(void*))alice_main, m)) {
        fprintf(stderr, "Failed to start alice.\n");
        return -1;
    }

    if (pthread_create(&bob, NULL, (void *(*)(void*))bob_main, m)) {
        fprintf(stderr, "Failed to start bob.\n");
        return -1;
    }

    pthread_join(alice, NULL);
    pthread_join(bob, NULL);
    DESTROY(m);
    DESTROY(m + 1);

    return 0;
}
开发者ID:Smattr,项目名称:mattutils,代码行数:31,代码来源:example.c

示例2: RunGame

void RunGame( int load) {
    game g = NULL;
    if(load) {
        g = LoadGame();
    } else {
        g = NewGame();
    }
    if(g==NULL) {
        return;
    }
    wrefresh(g->arena);
    wrefresh(g->status);
    if(g!=NULL) {
        if(g->pc) g->print(g->pc);
        creature G = CreateCreature(g);
        G = g->ZombieListHead;
        while(G) {
            g->print(G->Character);
            G = G->Next;
        }
        PrintAllBuildings(g->gameMap, g->pc->pos);
        PlayLoop(g);
        if(G) {
            PurgeCreatureNode(G);
            DESTROY(G);
        }
        PurgeGame(g);
        DESTROY(g);
    }
}
开发者ID:cryptarch,项目名称:zombies,代码行数:30,代码来源:Game.c

示例3: DESTROY

void Scene::shRotateAllLights( const Matrix& matrixRotation )
{
  DESTROY( spRotated ) ; // destroy the old one before making the new one.
  
  SHVector* summedLight = sumAllLights() ;
  
  // rotate the summed light
  spRotated = summedLight->rotate( matrixRotation ) ;
  DESTROY( summedLight ) ; // after i rotate it i only need the rotated result
}
开发者ID:sdp0et,项目名称:gtp,代码行数:10,代码来源:Scene.cpp

示例4: configrow_object_free

static void
configrow_object_free (ConfigRow *row)
{
    ASSERT (row != NULL);

    FREE (row->tag);

    DESTROY (ConfigPair, row->pair_head);
    DESTROY (ConfigVector, row->vector_head);

    FREE (row);
}
开发者ID:johnbellone,项目名称:gtkworkbook,代码行数:12,代码来源:config.cpp

示例5: crashsim_bd

BD_t * crashsim_bd(BD_t * disk, uint32_t threshold)
{
	struct crashsim_info * info;
	BD_t * bd;
	
	info = malloc(sizeof(*info));
	if(!info)
		return NULL;
	bd = &info->my_bd;
	
	info->blocks = hash_map_create();
	if(!info->blocks)
	{
		free(info);
		return NULL;
	}
	
	BD_INIT(bd, crashsim_bd);
	
	info->bd = disk;
	info->threshold = threshold;
	info->crashed = 0;
	info->absorbed = 0;
	info->total = 0;
	bd->blocksize = disk->blocksize;
	bd->numblocks = disk->numblocks;
	bd->atomicsize = disk->atomicsize;
	bd->level = disk->level;
	bd->graph_index = disk->graph_index + 1;
	if(bd->graph_index >= NBDINDEX)
	{
		DESTROY(bd);
		return NULL;
	}
	
	if(modman_add_anon_bd(bd, __FUNCTION__))
	{
		DESTROY(bd);
		return NULL;
	}
	if(modman_inc_bd(disk, bd, NULL) < 0)
	{
		modman_rem_bd(bd);
		DESTROY(bd);
		return NULL;
	}
	
	printf("Crash simulator block device initialized (threshold %u)\n", threshold);
	return bd;
}
开发者ID:pombredanne,项目名称:fstitch,代码行数:50,代码来源:crashsim_bd.c

示例6: block_resizer_bd

BD_t * block_resizer_bd(BD_t * disk, uint16_t blocksize)
{
	struct resize_info * info;
	uint16_t original_size;
	BD_t * bd;
	
	original_size = disk->blocksize;
	/* make sure it's an even multiple of the block size */
	if(blocksize % original_size)
		return NULL;
	/* block resizer not needed */
	if(blocksize == original_size)
		return NULL;
	
	info = malloc(sizeof(*info));
	if(!info)
		return NULL;

	bd = &info->my_bd;
	BD_INIT(bd, block_resizer_bd);
	
	info->bd = disk;
	info->original_size = original_size;
	bd->blocksize = blocksize;
	info->merge_count = blocksize / original_size;
	bd->atomicsize = disk->atomicsize;
	bd->numblocks = disk->numblocks / info->merge_count;
	bd->level = disk->level;
	bd->graph_index = disk->graph_index + 1;
	if(bd->graph_index >= NBDINDEX)
	{
		DESTROY(bd);
		return NULL;
	}
	
	if(modman_add_anon_bd(bd, __FUNCTION__))
	{
		DESTROY(bd);
		return NULL;
	}
	if(modman_inc_bd(disk, bd, NULL) < 0)
	{
		modman_rem_bd(bd);
		DESTROY(bd);
		return NULL;
	}
	
	return bd;
}
开发者ID:pombredanne,项目名称:fstitch,代码行数:49,代码来源:block_resizer_bd.c

示例7: main

int main(int argc, char * argv[])
{
	char input_file[100];
	char lookup_file[100];

	lpm_root * root = NULL;

	if(argc != 4)
	{
		puts("./alg -v4/6 default_rule input_file");
		return 1;
	}

	ipv = strcmp("-v6", argv[1]) == 0 ? 6 : 4;

	sprintf(input_file, "./input/IPv%d/%s", ipv, argv[3]);
	sprintf(lookup_file, "./input/IPv%d/lookup", ipv);

	default_rule = atoi(argv[2]);
	root = INIT(default_rule);
	fillTable(root, input_file);
	printf("%lf\n", lookup(root, lookup_file));

	DESTROY(root);
}
开发者ID:vokracko,项目名称:BP-FastNet,代码行数:25,代码来源:bin.c

示例8: combuf_destroy

/* Уничтожение буфера. Функция вызывается только из внутренних задач.*/
static void combuf_destroy(const combuf_t combuf)
{
    ASSERT1(CHECK_COMBUF(combuf), "invalid combuf = %u", combuf);

    /* Пометить буфер для удаления */
    DESTROY(combuf);

    /* Если буфер последний в очереди, то удаляем его и
     * следующие буферы в очереди ( если они помечены для удаления ) */
    if (IS_BACK(combuf)) {
        cb_store_t _busy;
        cb_store_t cb_size;

        do {
            cb_size = SIZE(back);
            back = SUM(back, cb_size);

            __critical_enter();
            busy -= cb_size;
            _busy = busy;
            __critical_exit();

        } while ((0 < _busy) && IS_DESTROYED(back));

    }
}
开发者ID:MaxGekk,项目名称:ZigZag,代码行数:27,代码来源:combuf.c

示例9: DESTROY

MethodRegex::~MethodRegex()
{
	for (std::vector<wxRegEx *>::iterator i = m_regex.begin(); i != m_regex.end(); ++i)
	{
		DESTROY(*i);
	}
}
开发者ID:nocturnal,项目名称:FragmentShader,代码行数:7,代码来源:method.cpp

示例10: DESTROY

MenuState::~MenuState()
{
	if (m_States != 0)
	{
		DESTROY(m_States);
	}
}
开发者ID:nocturnal,项目名称:FragmentShader,代码行数:7,代码来源:menustate.cpp

示例11: DestroyZombies

void DestroyZombies( game g ) {
    if( g == NULL ) return;
    if( g->ZombieListHead == NULL ) return;
    while( g->ZombieListHead->Next != NULL ) {
        creature G = g->ZombieListHead->Next;
        CutCreatureNode( g->ZombieListHead, G );
        if(G != NULL) {
            PurgeCreatureNode( G );
            DESTROY(G);
        }
    }
    if( g->ZombieListHead != NULL ) {
        PurgeCreatureNode( g->ZombieListHead );
        DESTROY( g->ZombieListHead );
    }
}
开发者ID:cryptarch,项目名称:zombies,代码行数:16,代码来源:Game.c

示例12: DESTROY

void CBlock::clear() {
	for (auto iter = blockContents.begin(); iter != blockContents.end();) {
		DESTROY(iter->second);
		iter++;
	}
	blockContents.clear();
}
开发者ID:ideallx,项目名称:serveree,代码行数:7,代码来源:CBlock.cpp

示例13: config_method_destroy

static void
config_method_destroy (Config * c)
{
    ASSERT (c != NULL);

    DESTROY (ConfigBlock, c->block_head);

    config_object_free (c);
}
开发者ID:johnbellone,项目名称:gtkworkbook,代码行数:9,代码来源:config.cpp

示例14: DESTROY

void RealFieldValueCache::clear()
{
	if (find_element_xi_cache)
	{
		DESTROY(Computed_field_find_element_xi_cache)(&find_element_xi_cache);
		find_element_xi_cache = 0;
	}
	FieldValueCache::clear();
}
开发者ID:A1kmm,项目名称:libzinc,代码行数:9,代码来源:field_cache.cpp

示例15: DESTROY

AStar::~AStar()
{
  DESTROY( finalPath ) ; // delete the object,
  // but no necessarily the Graph * objects
  // that were passed in, because someone else
  // may still be using them.

  // DO NOT DELETE THE 'graph*' object!
  // It belongs to someone else.
}
开发者ID:superwills,项目名称:eternity,代码行数:10,代码来源:AStar.cpp


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