當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。