您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ spawn函数代码示例

51自学网 2021-06-03 08:08:43
  C++
这篇教程C++ spawn函数代码示例写得很实用,希望能帮到您。

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

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

示例1: spawn_monster

void spawn_monster() {    auto monster = spawn().lock();    monster->act = monster_act;    while(1) {        AxialPosition p;        int x = rnd(0, (int)game.map->width);        int y = rnd(0, (int)game.map->height);        game.map->from_data_coord(x, y, p);        if(game.map->empty(p)) {            monster->position = p;            break;        }    }    monster->energy_gain = rnd(100, 300);    add_message("Added monster with %i energy gain", monster->energy_gain);}
开发者ID:discoloda,项目名称:Projects,代码行数:23,


示例2: while

void Emitter::update(float dt){    accumulated_time_ += dt;    while (accumulated_time_ >= spawn_rate_)    {        accumulated_time_ -= spawn_rate_;        instances_.push_back(spawn());    }    size_t number = instances_.size();    for (size_t i = 0; i < number; i++)    {        instances_[i]->update(dt);        if (instances_[i]->done())        {            delete instances_[i];            std::swap(instances_[i],instances_[number-1]);            number--;        }    }    instances_.erase(instances_.begin() + number,instances_.end());}
开发者ID:nlguillemot,项目名称:tsukino,代码行数:23,


示例3: runorraise

voidrunorraise(const Arg *arg) {    const char **app = arg->v;    Arg a = { .ui = ~0 };    Monitor *mon;    Client *c;    XClassHint hint = { NULL, NULL };/* Tries to find the client */  for (mon = mons; mon; mon = mon->next) {    for (c = mon->clients; c; c = c->next) {      XGetClassHint(dpy, c->win, &hint);      if (hint.res_class && strcmp(app[2], hint.res_class) == 0) {        a.ui = c->tags;        view(&a);        focus(c);        return;      }    }  }  /* Client not found: spawn it */  spawn(arg);} 
开发者ID:dougpiston,项目名称:dwm,代码行数:23,


示例4: make_bubbles

void make_bubbles(){	gedict_t       *bubble;	bubble = spawn();	setmodel( bubble, "progs/s_bubble.spr" );	setorigin( bubble, PASSVEC3( self->s.v.origin ) );	bubble->s.v.movetype = MOVETYPE_NOCLIP;	bubble->s.v.solid = SOLID_NOT;	SetVector( bubble->s.v.velocity, 0, 0, 15 );	bubble->s.v.nextthink = g_globalvars.time + 0.5;	bubble->think = ( func_t ) bubble_bob;	bubble->touch = ( func_t ) bubble_remove;	bubble->classname = "bubble";	bubble->s.v.frame = 0;	bubble->cnt = 0;	setsize( bubble, -8, -8, -8, 8, 8, 8 );	self->s.v.nextthink = g_globalvars.time + g_random() + 0.5;	self->think = ( func_t ) make_bubbles;}
开发者ID:deurk,项目名称:ktx,代码行数:23,


示例5: spawn_tdeath

void spawn_tdeath( vec3_t org, gedict_t * death_owner ){	gedict_t       *death;	death = spawn();	death->s.v.classname = "teledeath";	death->s.v.movetype = MOVETYPE_NONE;	death->s.v.solid = SOLID_TRIGGER;	SetVector( death->s.v.angles, 0, 0, 0 );	setsize( death, death_owner->s.v.mins[0] - 1, death_owner->s.v.mins[1] - 1,		      death_owner->s.v.mins[2] - 1, death_owner->s.v.maxs[0] + 1,		      death_owner->s.v.maxs[1] + 1, death_owner->s.v.maxs[2] + 1 );	setorigin( death, PASSVEC3( org ) );	death->s.v.touch = ( func_t ) tdeath_touch;	death->s.v.nextthink = g_globalvars.time + 0.2;	death->s.v.think = ( func_t ) SUB_Remove;	death->s.v.owner = EDICT_TO_PROG( death_owner );	g_globalvars.force_retouch = 2;	// make sure even still objects get hit}
开发者ID:angeld29,项目名称:qwprogs-qvm,代码行数:23,


示例6: do_stop

/* * This function simply stops the service p. * @param s A Service_T object * @param flag TRUE if the monitoring should be disabled or FALSE if monitoring should continue (when stop is part of restart) * @return TRUE if the service was stopped otherwise FALSE */static int do_stop(Service_T s, int flag) {        int rv = TRUE;        ASSERT(s);        if (s->depend_visited)                return rv;        s->depend_visited = TRUE;        if (s->stop) {                if (s->type != TYPE_PROCESS || Util_isProcessRunning(s, FALSE)) {                        LogInfo("'%s' stop: %s/n", s->name, s->stop->arg[0]);                        spawn(s, s->stop, NULL);                        if (s->type == TYPE_PROCESS && (wait_process(s, Process_Stopped) != Process_Stopped)) // Only wait for process service types stop                                rv = FALSE;                }        } else {                LogDebug("'%s' stop skipped -- method not defined/n", s->name);        }        if (flag)                Util_monitorUnset(s);        else                Util_resetInfo(s);                return rv;}
开发者ID:plfrancis,项目名称:clearwater-monit,代码行数:29,


示例7: agent_spawn

voidagent_spawn (bool opt_verbose){  // start agent if needed (sfsagent -c)  if (!isagentrunning ()) {    if (opt_verbose)      warn << "No existing agent found; spawning a new one.../n";    str sa = find_program ("sfsagent");    vec<char *> av;    av.push_back (const_cast<char *> (sa.cstr ()));    av.push_back ("-c");    av.push_back (NULL);    pid_t pid = spawn (av[0], av.base ());    if (waitpid (pid, NULL, 0) < 0)      fatal << "Could not spawn a new SFS agent: " <<	strerror (errno) << "/n";  }  else {    if (opt_verbose)      warn << "Contacting existing agent.../n";  }}
开发者ID:dougc333,项目名称:sfs_eventdrivenc--templatelibrary,代码行数:23,


示例8: mainloop

/** WMFS main loop. */static voidmainloop(void){     XEvent ev;     pthread_t th_status;     if (estatus && conf.status_timing == 0)          conf.status_pid = spawn(conf.status_path);     else if (estatus && pthread_create(&th_status, NULL, thread_status, NULL) != 0) {          warnx("pthread_create");          estatus = False;     }     while (!exiting && !XNextEvent(dpy, &ev)) {          getevent(ev);          wait_childs_and_status();     }     if (estatus)          pthread_join(th_status, NULL);     return;}
开发者ID:wavebeem,项目名称:wmfs,代码行数:25,


示例9: HoloDood

// spawn the actual holovoid HoloDood ( ){	gedict_t *holo;	vec3_t vtemp;	sound( self, 1, "weapons/railgr1a.wav", 0.6, 1 );	holo = spawn(  );	holo->s.v.owner = EDICT_TO_PROG( self );	vtemp[0] =		self->s.v.origin[0];	vtemp[1] =		self->s.v.origin[1];	vtemp[2] =		self->s.v.origin[2] + 24;	setorigin( holo, PASSVEC3( vtemp ) );	holo->s.v.angles[1] = self->s.v.angles[1];	holo->s.v.angles[0] = self->s.v.angles[0];	holo->s.v.skin = self->s.v.skin;	holo->s.v.frame = self->s.v.frame;	holo->s.v.colormap = self->s.v.colormap;	holo->s.v.flags = 256;	holo->s.v.solid = SOLID_TRIGGER;	holo->s.v.effects = EF_DIMLIGHT;	holo->s.v.movetype = MOVETYPE_TOSS;	setmodel( holo, "progs/player.mdl" );	setsize( holo, -16, -16, -24, 16, 16, 32 );	holo->s.v.classname = "holo";	holo->playerclass = 0;	holo->s.v.nextthink = g_globalvars.time + 1;	holo->s.v.think = ( func_t ) HoloHumm;	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );	trap_WriteByte( MSG_MULTICAST, 11 );	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );	trap_multicast( PASSVEC3( self->s.v.origin ), 1 );}
开发者ID:MrPnut,项目名称:QHome,代码行数:38,


示例10: run_main

intrun_main (int, ACE_TCHAR *[]){  ACE_START_TEST (ACE_TEXT ("MM_Shared_Memory_Test"));#if !defined (ACE_LACKS_MMAP) && !defined (ACE_DISABLE_MKTEMP)  ACE_TCHAR temp_file[MAXPATHLEN + 1];  // Get the temporary directory,  // The - 24 is for the filename, mm_shared_mem_testXXXXXX  if (ACE::get_temp_dir (temp_file, MAXPATHLEN - 24) == -1)    ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Temporary path too long/n")), -1);  // Add the filename to the end  ACE_OS::strcat (temp_file, ACE_TEXT ("mm_shared_mem_testXXXXXX"));  // Store in the global variable.  shm_key = temp_file;  if (ACE_OS::mktemp (shm_key) == 0      || (ACE_OS::unlink (shm_key) == -1          && errno == EPERM))    ACE_ERROR_RETURN ((LM_ERROR,                       ACE_TEXT ("(%P|%t) %p/n"),                       shm_key),                      1);  spawn ();#else /* !ACE_LACKS_MMAP */  ACE_ERROR ((LM_INFO,              ACE_TEXT ("mmap and mktemp")              ACE_TEXT ("are required for this test/n")));#endif /* !ACE_LACKS_MMAP */  ACE_END_TEST;  return 0;}
开发者ID:suiye223,项目名称:ace-linux,代码行数:37,


示例11: SpectatorConnect

////////////////// GlobalParams:// time// self// params///////////////void SpectatorConnect(){	gedict_t *p;	int diff = (int)(PROG_TO_EDICT(self->s.v.goalentity) - world);	if ( !SpecCanConnect( self ) )	{		stuffcmd(self, "disconnect/n"); // FIXME: stupid way		return;	}	SpecDecodeLevelParms();	self->ct = ctSpec;	self->s.v.classname = "spectator"; // Added this in for kick code	self->k_accepted = 1; // spectator has no restriction to connect	for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); )		if ( p != self )  // does't show msg for self			G_sprint( p, PRINT_HIGH, "Spectator %s entered the game/n", self->s.v.netname  );	if ( diff < 0 || diff >= MAX_EDICTS ) // something wrong happen - fixing		self->s.v.goalentity = EDICT_TO_PROG( world );	VIP_ShowRights( self );	CheckRate(self, "");	if ( match_in_progress != 2 ) {		self->wizard = spawn();		self->wizard->s.v.classname = "spectator_wizard";		self->wizard->s.v.think = ( func_t ) wizard_think;		self->wizard->s.v.nextthink = g_globalvars.time + 0.1;	}	// Wait until you do stuffing	MakeMOTD();}
开发者ID:devrac,项目名称:ktx,代码行数:43,


示例12: run

/** * Run a script. argv[2] is already NULL. */static int run(char *argv[3], struct in_addr *ip){	int status;	char *addr = addr; /* for gcc */	const char *fmt = "%s %s %s" + 3;	VDBG("%s run %s %s/n", intf, argv[0], argv[1]);	if (ip) {		addr = inet_ntoa(*ip);		setenv("ip", addr, 1);		fmt -= 3;	}	bb_info_msg(fmt, argv[1], intf, addr);	status = wait4pid(spawn(argv));	if (status < 0) {		bb_perror_msg("%s %s %s" + 3, argv[1], intf);		return -errno;	}	if (status != 0)		bb_error_msg("script %s %s failed, exitcode=%d", argv[0], argv[1], status);	return status;}
开发者ID:benjaminlevine,项目名称:Huawei-HG633-Open-Source-Software-Package,代码行数:27,


示例13: spawn

void CreatureManager::loadSpawns(const std::string& fileName){    if(!isLoaded()) {        g_logger.warning("creatures aren't loaded yet to load spawns.");        return;    }    if(m_spawnLoaded) {        g_logger.warning("attempt to reload spawns.");        return;    }    try {        TiXmlDocument doc;        doc.Parse(g_resources.readFileContents(fileName).c_str());        if(doc.Error())            stdext::throw_exception(stdext::format("cannot load spawns xml file '%s: '%s'", fileName, doc.ErrorDesc()));        TiXmlElement* root = doc.FirstChildElement();        if(!root || root->ValueStr() != "spawns")            stdext::throw_exception("malformed spawns file");        for(TiXmlElement* node = root->FirstChildElement(); node; node = node->NextSiblingElement()) {            if(node->ValueTStr() != "spawn")                stdext::throw_exception("invalid spawn node");            SpawnPtr spawn(new Spawn);            spawn->load(node);            m_spawns.insert(std::make_pair(spawn->getCenterPos(), spawn));        }        doc.Clear();        m_spawnLoaded = true;    } catch(std::exception& e) {        g_logger.error(stdext::format("Failed to load '%s': %s", fileName, e.what()));    }}
开发者ID:Anastaciaa,项目名称:otclient-1,代码行数:36,


示例14: cvar

gedict_t *ThrowGib( char *gibname, float dm ){	gedict_t       *newent;	int			    k_short_gib = cvar( "k_short_gib" ); // if set - remove faster	newent = spawn();	VectorCopy( self->s.v.origin, newent->s.v.origin );	setmodel( newent, gibname );	setsize( newent, 0, 0, 0, 0, 0, 0 );	VelocityForDamage( dm, newent->s.v.velocity );	newent->s.v.movetype = MOVETYPE_BOUNCE;	newent->isMissile = true;	newent->s.v.solid = SOLID_NOT;	newent->s.v.avelocity[0] = g_random() * 600;	newent->s.v.avelocity[1] = g_random() * 600;	newent->s.v.avelocity[2] = g_random() * 600;	newent->think = ( func_t ) SUB_Remove;	newent->s.v.ltime = g_globalvars.time;	newent->s.v.nextthink = g_globalvars.time + ( k_short_gib ? 2 : ( 10 + g_random() * 10 ) );	newent->s.v.frame = 0;	newent->s.v.flags = 0;	return newent;}
开发者ID:deurk,项目名称:ktx,代码行数:24,


示例15: main

int main (int argc, char *argv[]){	char* arg_list[10] = {};	/*no argmuments*/	if(argc <= 1){	  childParent();   	  return 0;	}else if(argc == 2){/*one argument*/	  spawnOne(argv[1]);	}else{/*multiple arguments*/	  int i = 0;	  while(i<argc){	    if(i+1==argc){	      arg_list[i] = NULL;	    }	    else{	      arg_list[i] = argv[i+1];	    }	    i++;	  }	  spawn (argv[1], arg_list);	}	printf("done with main program/n");	return 0;}
开发者ID:akendall,项目名称:cs3060-Spring,代码行数:24,


示例16: udhcp_run_script

/* Call a script with a par file and env vars */void FAST_FUNC udhcp_run_script(struct dhcp_packet *packet, const char *name){	char **envp, **curr;	char *argv[3];	if (client_config.script == NULL)		return;	envp = fill_envp(packet);	/* call script */	log1("Executing %s", client_config.script);	argv[0] = (char*) client_config.script;	argv[1] = (char*) name;	argv[2] = NULL;	wait4pid(spawn(argv));	for (curr = envp; *curr; curr++) {		log2(" %s", *curr);		bb_unsetenv(*curr);		free(*curr);	}	free(envp);}
开发者ID:Cheezzolo123,项目名称:MonteDroid,代码行数:25,


示例17: QGraphicsScene

Game::Game(){  //  start = new Start();    scene = new QGraphicsScene();    player = new Player();    scene->addItem(player);  /*  QGraphicsPixmapItem *drum = new QGraphicsPixmapItem();    drum->setPixmap(QPixmap(":/images/testdrum2.png"));    drum->setPos(0,143);    scene->addItem(drum);*/    player->setFlag(QGraphicsItem::ItemIsFocusable);    player->setFocus();    setScene(scene);    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);    setFixedSize(768,557);    scene->setSceneRect(0,0,768,557);    scene->setBackgroundBrush(QBrush(QPixmap(":/image/bgg6.png")));    //create the score    score = new Score();    scene->addItem(score);    QTimer * timer = new QTimer();    QObject::connect(timer,SIGNAL(timeout()),player,SLOT(spawn()));    timer->start(1200);    mytimer = new Mytimer();    scene->addItem(mytimer);}
开发者ID:jjoe0303,项目名称:Qttest,代码行数:36,


示例18: memset

void SpawnMgr::spawnEntity(ai::Zone& zone, network::messages::NpcType start, network::messages::NpcType end, int maxAmount) {	const int offset = start + 1;	int count[end - offset];	memset(count, 0, sizeof(count));	zone.execute([start, end, offset, &count] (const ai::AIPtr& ai) {		const AICharacter& chr = ai::character_cast<AICharacter>(ai->getCharacter());		const Npc& npc = chr.getNpc();		const network::messages::NpcType type = npc.npcType();		if (type <= start || type >= end)			return;		const int index = type - offset;		++count[index];	});	const int size = SDL_arraysize(count);	for (int i = 0; i < size; ++i) {		if (count[i] >= maxAmount)			continue;		const int needToSpawn = maxAmount - count[i];		network::messages::NpcType type = static_cast<network::messages::NpcType>(offset + i);		spawn(zone, type, needToSpawn);	}}
开发者ID:mgerhardy,项目名称:engine,代码行数:24,


示例19: user_k

void user_k( void ) {	int i;	int pid;	char buf[16];	write( FD_CONSOLE, "User K running/n", 0 );	write( FD_SIO, "K", 1 );	for( i = 0; i < 3 ; ++i ) {		pid = spawn( user_x );		if( pid < 0 ) {			write( FD_CONSOLE, "User K spawn() #", 0 );			pid = itos10( buf, i );			write( FD_CONSOLE, buf, pid );			write( FD_CONSOLE, " failed/n", 0 );		} else {			sleep( SECONDS_TO_MS(30) );			write( FD_SIO, "K", 1 );		}	}	write( FD_CONSOLE, "User K exiting/n", 0 );	exit();}
开发者ID:robopt,项目名称:systems-programming,代码行数:24,


示例20: user_j

void user_j( void ) {	int i;	int pid;	char buf[16];	write( FD_CONSOLE, "User J running/n", 0 );	write( FD_SIO, "J", 1 );	for( i = 0; i < N_PROCS * 2 ; ++i ) {		pid = spawn( user_y );		if( pid < 0 ) {			write( FD_SIO, "j", 1 );			write( FD_CONSOLE, "User J spawn() #", 0 );			pid = itos10( buf, i );			write( FD_CONSOLE, buf, pid );			write( FD_CONSOLE, " failed/n", 0 );		} else {			write( FD_SIO, "J", 1 );		}	}	write( FD_CONSOLE, "User J exiting/n", 0 );	exit();}
开发者ID:robopt,项目名称:systems-programming,代码行数:24,


示例21: jump

void GOBall::tick() {	GameObject::tick();	    if (!m_Alive)        return;    m_ScoreObject->updateScore(m_Score);	jump();	updateVelocity();		// sync the position of the physics and graphics objects	CPhysicsObject* physicsComponent = (CPhysicsObject*)getComponent(CPhysicsObject::classTypeID());	b2Body* body = physicsComponent->getBody();		b2Vec2 position = body->GetPosition();	float32 angle = body->GetAngle();    if (position.y < -200)        spawn();	CGraphicsObject* graphicsComponent = (CGraphicsObject*)getComponent(CGraphicsObject::classTypeID());	graphicsComponent->setPosition(position.x, position.y, 0.0f);}
开发者ID:futureneer,项目名称:wallframe_apps,代码行数:24,


示例22: HLSLive

boolLiveFile::start(const void * arg){    int ret = 0;    const char * file = (const char *)arg;    m_hlslive = new HLSLive();    if (!m_hlslive->build("E://nginx//nginx-1.9.9//html//hls", ///< path                          "camera",                            ///< output prefix                          "camera.m3u8",                       ///< index file name                          "camera/",                           ///< URI prefix                          10,                                  ///< max segment duration                          6))                                  ///< max segments    {        goto fail;    }    ret = ::av_file_map(file, &m_filedata, &m_datasize, 0, NULL);    if (ret < 0)    {        fprintf(stderr, "unable to map input file: %s/n", av_err2str(ret));        goto fail;    }    spawn();    return true;fail:    stop();    return false;}
开发者ID:cubieb,项目名称:HLSLive,代码行数:36,


示例23: main

int main( void ) {	int i;	int pid;	time_t time;	time = gettime();	c_printf( "User L running, initial time %u/n", time );	writech( 'L' );	for( i = 0; i < 3 ; ++i ) {		time = gettime();		pid = spawn( "/USER_X.B" );		if( pid < 0 ) {			c_printf( "User L spawn() #%d failed @%08u/n", i, time );		} else {			sleep( 0 );			writech( 'L' );		}	}	time = gettime();	c_printf( "User L exiting at time %u/n", time );	exit();}
开发者ID:solb,项目名称:sysprogos,代码行数:24,


示例24: DropQuad

void DropQuad( float timeleft ){	gedict_t       *item;	item = spawn();	VectorCopy( self->s.v.origin, item->s.v.origin );	item->s.v.velocity[2] = 300;	item->s.v.velocity[0] = -100 + ( g_random() * 200 );	item->s.v.velocity[1] = -100 + ( g_random() * 200 );	item->s.v.flags = FL_ITEM;	item->s.v.solid = SOLID_TRIGGER;	item->s.v.movetype = MOVETYPE_TOSS;	item->s.v.noise = "items/damage.wav";	setmodel( item, "progs/quaddama.mdl" );	setsize( item, -16, -16, -24, 16, 16, 32 );	item->cnt = g_globalvars.time + timeleft;	item->s.v.touch = ( func_t ) q_touch;	item->s.v.nextthink = g_globalvars.time + timeleft;	// remove it with the time left on it	item->s.v.think = ( func_t ) SUB_Remove;}
开发者ID:angeld29,项目名称:qwprogs-qvm,代码行数:24,


示例25: forasync3D_flat

void forasync3D_flat(void *forasync_arg) {    forasync3D_t *forasync = (forasync3D_t *) forasync_arg;    hclib_loop_domain_t loop0 = forasync->loop[0];    hclib_loop_domain_t loop1 = forasync->loop[1];    hclib_loop_domain_t loop2 = forasync->loop[2];    int low0, low1, low2;    for(low0=loop0.low; low0<loop0.high; low0+=loop0.tile) {        int high0 = (low0+loop0.tile)>loop0.high?loop0.high:(low0+loop0.tile);#if DEBUG_FORASYNC        printf("Scheduling Task Loop1 %d %d/n",low0,high0);#endif        for(low1=loop1.low; low1<loop1.high; low1+=loop1.tile) {            int high1 = (low1+loop1.tile)>loop1.high?loop1.high:(low1+loop1.tile);#if DEBUG_FORASYNC            printf("Scheduling Task Loop2 %d %d/n",low1,high1);#endif            for(low2=loop2.low; low2<loop2.high; low2+=loop2.tile) {                int high2 = (low2+loop2.tile)>loop2.high?loop2.high:(low2+loop2.tile);#if DEBUG_FORASYNC                printf("Scheduling Task %d %d/n",low2,high2);#endif                forasync3D_task_t *new_forasync_task = allocate_forasync3D_task();                new_forasync_task->forasync_task._fp = forasync3D_runner;                new_forasync_task->forasync_task.args = &(new_forasync_task->def);                new_forasync_task->def.base.user = forasync->base.user;                hclib_loop_domain_t new_loop0 = {low0, high0, loop0.stride, loop0.tile};                new_forasync_task->def.loop[0] = new_loop0;                hclib_loop_domain_t new_loop1 = {low1, high1, loop1.stride, loop1.tile};                new_forasync_task->def.loop[1] = new_loop1;                hclib_loop_domain_t new_loop2 = {low2, high2, loop2.stride, loop2.tile};                new_forasync_task->def.loop[2] = new_loop2;                spawn((hclib_task_t *)new_forasync_task);            }        }    }}
开发者ID:habanero-rice,项目名称:hclib,代码行数:36,


示例26: spawn

void SmokeSource::animate(){  float up_scale = Window::delta_time / 2000.0f;  float side_scale = Window::delta_time / 6000.0f;  // update velocity  for (unsigned int i = 0; i < particles; i++)    velocity_data[i * 3 + 1] += up_scale * -1.0f;  // update position  for (unsigned int i = 0; i < particles; i++)  {    position_data[i * 3 + 0] += velocity_data[i * 3 + 0] * side_scale;    position_data[i * 3 + 1] += velocity_data[i * 3 + 1] * side_scale;    position_data[i * 3 + 2] += velocity_data[i * 3 + 2] * side_scale;  }  // kill and respawn particles  for (unsigned int i = 0; i < particles; i++)  {    if (position_data[i * 3 + 1] <= 0.0f)    {      if (particles <= desired_particles)        spawn(i);      else      {        kill(i); // kill and swap with last particle        i--; // check again on this position, since another particle will be here      }    }  }  // update data in buffer  glBindBuffer(GL_ARRAY_BUFFER, position_buffer);  glBufferSubData(GL_ARRAY_BUFFER, 0, particles * 3 * sizeof(GLfloat), position_data);}
开发者ID:FelixHoer,项目名称:AirPollution,代码行数:36,


示例27: main

intmain(void){	int sig;	size_t i;	if (getpid() != 1)		return 1;	chdir("/");	sigfillset(&set);	sigprocmask(SIG_BLOCK, &set, NULL);	spawn(rcinitcmd);	while (1) {		sigwait(&set, &sig);		for (i = 0; i < LEN(sigmap); i++) {			if (sigmap[i].sig == sig) {				sigmap[i].handler();				break;			}		}	}	/* not reachable */	return 0;}
开发者ID:henrysher,项目名称:sinit,代码行数:24,


示例28: main

int main( int argc, char **argv){	int my_stdin = 0, my_stdout = 0, my_stderr = 0;	pid_t child_pid;	ssize_t bytes_read;	char *command = { "/usr/bin/echo" };	char *buffer[1024];		if ( argv[1] )	{		spawn( command, argv, NULL, &my_stdin, &my_stdout, &my_stderr, &child_pid );	}		bytes_read = read( my_stdout, buffer, 1023 );		printf( "read return value: %d/n", bytes_read );	printf( "%s/n", buffer );		bytes_read = read( my_stderr, buffer, 1023 );	fprintf( stderr, "Bytes read from stderr: %d/n", bytes_read );	fprintf( stderr, "%s/n", buffer );		return 0;}
开发者ID:bluehavana,项目名称:presentations,代码行数:24,


示例29: test_common

    static void test_common()    {        try        {            std::size_t user_thr_num = 5;            std::size_t my_actor_size = 10;            attributes attrs;            attrs.mixin_num_ = user_thr_num + 1;            context ctx(attrs);            mixin_t base = spawn(ctx);            aid_t base_id = base.get_aid();            boost::thread_group thrs;            for (std::size_t i=0; i<user_thr_num; ++i)            {                thrs.create_thread(                    boost::bind(                        &match_ut::my_thr,                        boost::ref(ctx), base_id                    )                );            }            thrs.join_all();            for (std::size_t i=0; i<my_actor_size; ++i)            {                recv(base, 1);            }        }        catch (std::exception& ex)        {            std::cerr << ex.what() << std::endl;        }    }
开发者ID:BianJian,项目名称:gce1.0,代码行数:36,



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


C++ spawn_thread函数代码示例
C++ spatium函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。