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

C++ reset_timer函数代码示例

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

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



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

示例1: update_NPCs

void update_NPCs( NPC** _NPCs, int _NPCCount, bomb* _pBomb, map* _pMap )
{
    // loop through all NPCs
    int i;
    for ( i = 0; i < _NPCCount; i++ )
    {
        // update NPC's coordinates atributes
        _NPCs[i]->right  = _NPCs[i]->left + GC_block_size;
        _NPCs[i]->bottom = _NPCs[i]->top  + GC_block_size;

        _NPCs[i]->i = ( ( (_NPCs[i]->top + GC_block_size/2) - GC_y_offset) / GC_block_size );
        _NPCs[i]->j = ( (_NPCs[i]->left + GC_block_size/2) / GC_block_size );

        // invoke NPC's artificial intelligence, but not every loop
        // delay the artificial intelligence, it mustn't run each loop
        if ( time_is_up( _NPCs[i]->AI_timer ) )
        {
            //_NPCs[i]->p_NPC_AI( _pGame );

            NPC_random_walk_AI( _NPCs[i], _pBomb, _NPCs, _NPCCount, _pMap );

            reset_timer( _NPCs[i]->AI_timer );
        }
        else
        {
            // delay the NPC's walk
            if ( time_is_up( _NPCs[i]->walk_timer ) )
            {
                NPC_walk( _NPCs[i], _pBomb, _NPCs, _NPCCount, _pMap, _NPCs[i]->direction );

                reset_timer( _NPCs[i]->walk_timer );
            }
        }
    }
}
开发者ID:c-neves,项目名称:pinky-dinky-doo-revenge,代码行数:35,代码来源:npc.c


示例2: main

int main(int argc, const char * argv[]){
	clock_t begin = clock();

    if(argc == 1){
		// standard mode
		mpz_t numbers[NUMBERS];
		list * calculatedFactors[NUMBERS];
		int i;
		mpz_t y;
		mpz_init_set_ui(y, 1);

		for (i = 0; i < NUMBERS; i++){
			mpz_init(numbers[i]);
			mpz_inp_str(numbers[i], stdin, 10);
		}

		for (i = 0; i < NUMBERS; i++) {
			reset_timer();
			list* factors = createList();
			factorize(factors, numbers[i],1, y);
			
			calculatedFactors[i] = factors;
		}

		for (i = 0; i < NUMBERS; i++){
			printFactors(calculatedFactors[i]);
		}

		clock_t end = clock();
		double tdiff = (((double) end) - ((double)begin)) / CLOCKS_PER_SEC;
		printf(", %f\n", tdiff);
		
		return 0;
		
	} else if(strcmp(argv[1], "interactive") == 0){
		// interactive mode
		fprintf(stderr, "Interactive mode!\n");
		
		mpz_t number;
		mpz_init(number);
		list * factors = NULL;
		mpz_t y;
		mpz_init_set_ui(y, 1);

		while (1) {
			mpz_inp_str(number, stdin, 10);
			reset_timer();
			factors = createList();
			factorize(factors, number, 1, y);

			TRACE("PRINTING FACTORS:\n");
			printFactors(factors);
		}

		return 0;
	}
    
    return 1;
}
开发者ID:ViktorCollin,项目名称:avalg12,代码行数:59,代码来源:main.c


示例3: cancel_invite

void cancel_invite(struct sip_msg *cancel_msg,
								struct cell *t_cancel, struct cell *t_invite )
{
#define CANCEL_REASON_SIP_487  \
	"Reason: SIP;cause=487;text=\"ORIGINATOR_CANCEL\"" CRLF

	branch_bm_t cancel_bitmap;
	branch_bm_t dummy_bm;
	str reason;
	unsigned int i;
	struct hdr_field *hdr;

	cancel_bitmap=0;

	/* send back 200 OK as per RFC3261 */
	reason.s = CANCELING;
	reason.len = sizeof(CANCELING)-1;
	t_reply( t_cancel, cancel_msg, 200, &reason );

	reason.s = NULL;
	reason.len = 0;
	/* propagate the REASON flag ? */
	if ( t_cancel->flags&T_CANCEL_REASON_FLAG ) {
		/* look for the Reason header */
		if (parse_headers(cancel_msg, HDR_EOH_F, 0)<0) {
			LM_ERR("failed to parse all hdrs - ignoring Reason hdr\n");
		} else {
			hdr = get_header_by_static_name(cancel_msg, "Reason");
			if (hdr!=NULL) {
				reason.s = hdr->name.s;
				reason.len = hdr->len;
			}
		}
	}

	/* if no reason, use NORMAL CLEARING */
	if (reason.s == NULL) {
		reason.s = CANCEL_REASON_SIP_487;
		reason.len = sizeof(CANCEL_REASON_SIP_487) - 1;
	}

	/* generate local cancels for all branches */
	which_cancel(t_invite, &cancel_bitmap );

	set_cancel_extra_hdrs( reason.s, reason.len);
	cancel_uacs(t_invite, cancel_bitmap );
	set_cancel_extra_hdrs( NULL, 0);

	/* internally cancel branches with no received reply */
	for (i=t_invite->first_branch; i<t_invite->nr_of_outgoings; i++) {
		if (t_invite->uac[i].last_received==0){
			/* reset the "request" timers */
			reset_timer(&t_invite->uac[i].request.retr_timer);
			reset_timer(&t_invite->uac[i].request.fr_timer);
			LOCK_REPLIES( t_invite );
			relay_reply(t_invite,FAKED_REPLY,i,487,&dummy_bm);
		}
	}
}
开发者ID:abh-gitcs1989,项目名称:opensips,代码行数:59,代码来源:t_fwd.c


示例4: cleanup_localcancel_timers

void cleanup_localcancel_timers( struct cell *t )
{
	int i;
	for (i=0; i<t->nr_of_outgoings; i++ )  {
		reset_timer(  &t->uac[i].local_cancel.retr_timer );
		reset_timer(  &t->uac[i].local_cancel.fr_timer );
	}
}
开发者ID:AndreiPlesa,项目名称:opensips,代码行数:8,代码来源:timer.c


示例5: cleanup_uac_timers

void cleanup_uac_timers( struct cell *t )
{
	int i;

	/* reset FR/retransmission timers */
	for (i=t->first_branch; i<t->nr_of_outgoings; i++ )  {
		reset_timer( &t->uac[i].request.retr_timer );
		reset_timer( &t->uac[i].request.fr_timer );
	}
	LM_DBG("RETR/FR timers reset\n");
}
开发者ID:iamroger,项目名称:voip,代码行数:11,代码来源:t_reply.c


示例6: t_release_transaction

/*   returns 1 if everything was OK or -1 for error
*/
int t_release_transaction( struct cell *trans )
{
	set_kr(REQ_RLSD);

	reset_timer( & trans->uas.response.fr_timer );
	reset_timer( & trans->uas.response.retr_timer );

	cleanup_uac_timers( trans );

	put_on_wait( trans );
	return 1;
}
开发者ID:NormB,项目名称:opensips,代码行数:14,代码来源:t_funcs.c


示例7: hw_platform_start_led_blink

/**
 * @brief 开始LED闪烁指示
 * @param[in] unsigned int		led		
 * @param[in] unsigned short	delay	闪烁的时间间隔,也就是闪烁频率,单位10ms
 * @note 注意此接口可以让几个LED同时按照各自不同的频率闪烁
*/
void hw_platform_start_led_blink(unsigned int led,unsigned short delay)
{
	int ret;
	hw_platform_led_ctrl(led,1);
	if (led == LED_RED)
	{
		if (current_led_state & LED_RED_ON_MASK)
		{
			current_led_state |= LED_RED_MASK;
			ret = reset_timer(led_timer_h[0],V_TIMER_MODE_PERIODIC,delay*10,led_red_blink_timer_hook);
			assert(ret == 0);
		}
		else
		{
			current_led_state |= (LED_RED_MASK | LED_RED_ON_MASK);
			led_timer_h[0] = start_timer(V_TIMER_MODE_PERIODIC,delay*10,led_red_blink_timer_hook);
			assert(led_timer_h[0] != 0);
		}
	}
	else if (led == LED_GREEN)
	{
		if (current_led_state & LED_GREEN_ON_MASK)
		{
			current_led_state |= LED_GREEN_MASK;
			ret = reset_timer(led_timer_h[2],V_TIMER_MODE_PERIODIC,delay*10,led_green_blink_timer_hook);
			assert(ret == 0);
		}
		else
		{
			current_led_state |= (LED_GREEN_MASK | LED_GREEN_ON_MASK);
			led_timer_h[2] = start_timer(V_TIMER_MODE_PERIODIC,delay*10,led_green_blink_timer_hook);
			assert(led_timer_h[2] != 0);
		}
	}
	else
	{
		if (current_led_state & LED_BLUE_ON_MASK)
		{
			current_led_state |= LED_BLUE_MASK;
			ret = reset_timer(led_timer_h[3],V_TIMER_MODE_PERIODIC,delay*10,LED_BLUE_blink_timer_hook);
			assert(ret == 0);
		}
		else
		{
			current_led_state |= (LED_BLUE_MASK | LED_BLUE_ON_MASK);
			led_timer_h[3] = start_timer(V_TIMER_MODE_PERIODIC,delay*10,LED_BLUE_blink_timer_hook);
			assert(led_timer_h[3] != 0);
		}
	}
}
开发者ID:joe3501,项目名称:BlueRing,代码行数:56,代码来源:hw_platform.c


示例8: create_game

/* External functions
 */
Game* create_game(void)
{
    int ii;
    Game* G = (Game*)calloc(1, sizeof(Game));
    G->timer = create_timer();
    G->graphics = create_graphics();
    G->ui = create_ui(G->graphics);

    /* Set up camera */
    G->camera = transform_zero;
    G->camera.orientation = quat_from_euler(0, -0.75f * kPi, 0);
    G->camera.position.x = 4.0f;
    G->camera.position.y = 2;
    G->camera.position.z = 7.5f;

    /* Load scene */
    reset_timer(G->timer);
    G->scene = create_scene("lightHouse.obj");
    G->sun_light.position = vec3_create(-4.0f, 5.0f, 2.0f);
    G->sun_light.color = vec3_create(1, 1, 1);
    G->sun_light.size = 35.0f;

    G->lights[0].color = vec3_create(1, 0, 0);
    G->lights[1].color = vec3_create(1, 1, 0);
    G->lights[2].color = vec3_create(0, 1, 0);
    G->lights[3].color = vec3_create(1, 0, 1);
    G->lights[4].color = vec3_create(0, 0, 1);
    G->lights[5].color = vec3_create(0, 1, 1);

    for(ii=0;ii<NUM_LIGHTS;++ii) {
        float x = (20.0f/NUM_LIGHTS) * ii - 8.0f;
        G->lights[ii].color = vec3_create(_rand_float(), _rand_float(), _rand_float());
        G->lights[ii].color = vec3_normalize(G->lights[ii].color);
        if(ii % 2)
            G->lights[ii].position = vec3_create(x, _rand_float()*3 + 2.0f, 0.0f);
        else
            G->lights[ii].position = vec3_create(0.0f, _rand_float()*3 + 2.0f, x);
        G->lights[ii].size = 5;
    }

    get_model(G->scene, 3)->material->specular_color = vec3_create(0.5f, 0.5f, 0.5f);
    get_model(G->scene, 3)->material->specular_coefficient = 1.0f;

    G->dynamic_lights = 1;

    reset_timer(G->timer);
    return G;
}
开发者ID:WeerasakS3,项目名称:OpenGL-ES-3.0-Deferred-Rendering,代码行数:50,代码来源:game.c


示例9: m_write_t

void m58846_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	if (id != 0)
		return;

	// timer 1: 7-bit fixed counter (manual specifically says 127)
	if (++m_tmr_count[0] == 127)
	{
		m_tmr_count[0] = 0;
		m_irqflag[1] = true;
		m_possible_irq = true;
	}

	// timer 2: 8-bit user defined counter with auto-reload
	if (m_v & 8 && ++m_tmr_count[1] == 0)
	{
		m_tmr_count[1] = m_tmr_reload;
		m_irqflag[2] = true;
		m_possible_irq = true;
		m_port_t ^= 1;
		m_write_t(m_port_t);
	}

	// schedule next timeout
	reset_timer();
}
开发者ID:Tauwasser,项目名称:mame,代码行数:26,代码来源:m58846.cpp


示例10: _auto_switch_start

status_t _auto_switch_start(void)
{
    uint32_t duration = 0;
    int32_t pic_switch_duration = 0;

    /*if(pic_switch_timer)
    {
    	printf("[PIC] play_pic_auto_switch_start pic_switch_timer is already created\n");
    	return GXCORE_ERROR;
    }*/

    pic_switch_duration = pmpset_get_int(PMPSET_PIC_SWITCH_DURATION);

    // TODO:  时间暂时推迟下,解码时间太长
    if(PMPSET_PIC_SWITCH_DURATION_3s == pic_switch_duration)duration = 3000;
    else if(PMPSET_PIC_SWITCH_DURATION_5s == pic_switch_duration)duration = 5000;
    else if(PMPSET_PIC_SWITCH_DURATION_7s == pic_switch_duration)duration = 7000;
    else if(PMPSET_PIC_SWITCH_DURATION_10s== pic_switch_duration)duration = 10000;

    if(0 != reset_timer(pic_switch_timer))
    {
        pic_switch_timer = create_timer(_auto_switch_pic, (int)duration, NULL, TIMER_REPEAT);
    }

    return GXCORE_SUCCESS;
}
开发者ID:kuikuitage,项目名称:GX3113C_JIMO,代码行数:26,代码来源:play_pic.c


示例11: app_pic_update_timer_reset

void app_pic_update_timer_reset(void)
{
	if (reset_timer(sp_PicUpdateTimer) != 0)
	{
		sp_PicUpdateTimer = create_timer(picasa_pic_update_timeout, 500, NULL, TIMER_REPEAT);
	}
}
开发者ID:github188,项目名称:GX3113C_JIMO,代码行数:7,代码来源:app_picasa.c


示例12: server_recv_cb

/*
 *
 * xsocks UDP Response
 * +------+----------+----------+----------+
 * | ATYP | DST.ADDR | DST.PORT |   DATA   |
 * +------+----------+----------+----------+
 * |  1   | Variable |    2     | Variable |
 * +------+----------+----------+----------+
 *
 */
static void
server_recv_cb(uv_udp_t *handle, ssize_t nread, const uv_buf_t *buf, const struct sockaddr *addr, unsigned flags) {
    if (nread > 0) {
        struct client_context *client = handle->data;
        reset_timer(client);

        int mlen = nread - PRIMITIVE_BYTES;
        uint8_t *m = (uint8_t *)buf->base;
        int rc = crypto_decrypt(m, (uint8_t *)buf->base, nread);
        if (rc) {
            logger_log(LOG_ERR, "invalid packet");
            goto err;
        }

        memmove(m, m + addrlen, mlen - addrlen);
        mlen -= addrlen;

        forward_to_client(client, m , mlen);

    } else {
        goto err;
    }

    return;

err:
    free(buf->base);
}
开发者ID:sinme,项目名称:xsocks-1,代码行数:38,代码来源:xforwarder_udprelay.c


示例13: main

int main() {

  test_setup();
  perf_start();

  for (int i = 0; i < NUM_ITER; ++i) {
    test_clear();

    reset_timer();
    start_timer();

    test_run(i);

    stop_timer();

    samples[i] = get_time();
  }

  perf_stop();
  int check = test_check();

  printf("Correct: %d\n", check);
  for (int i = 0; i < NUM_ITER; ++i)
    printf("TS[%d]: %d\n", i, samples[i]);

  perf_print_all();

  return 0;
}
开发者ID:pulp-platform,项目名称:pulpino,代码行数:29,代码来源:main.c


示例14: machine

void mb3773_device::device_start()
{
	m_watchdog_timer = machine().scheduler().timer_alloc( FUNC(watchdog_timeout), this );
	reset_timer();

	save_item( NAME(m_ck) );
}
开发者ID:LibXenonProject,项目名称:mame-lx,代码行数:7,代码来源:mb3773.c


示例15: run_n

 void run_n(size_t n) {
     d_num_iterations = n;
     reset_timer();
     start_timer();
     d_benchmark.get_func()(this);
     stop_timer();
 }
开发者ID:ymglez,项目名称:jsonpack,代码行数:7,代码来源:benchpress.hpp


示例16: app_picasa_feeds_update_timer_reset

void app_picasa_feeds_update_timer_reset(void)
{
	if (reset_timer(sp_PicasaFeedsUpdateTimer) != 0)
	{
		sp_PicasaFeedsUpdateTimer = create_timer(picasa_feeds_update_timer_timeout, 1000, NULL, TIMER_ONCE);
	}
}
开发者ID:github188,项目名称:GX3113C_JIMO,代码行数:7,代码来源:app_picasa.c


示例17: remote_recv_cb

static void
remote_recv_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
    struct remote_context *remote;
    struct client_context *client;

    remote = stream->data;
    client = remote->client;

    if (nread > 0) {
        reset_timer(remote);
        uv_read_stop(&remote->handle.stream);
        int clen = nread + PRIMITIVE_BYTES;
        uint8_t *c = remote->buf + HEADER_BYTES;
        int rc = crypto_encrypt(c, (uint8_t*)buf->base, nread);
        if (!rc) {
            forward_to_client(client, c, clen);
        } else {
            logger_log(LOG_ERR, "invalid tcp packet");
            close_client(client);
            close_remote(remote);
        }

    } else if (nread < 0){
        if (nread != UV_EOF) {
            logger_log(LOG_ERR, "receive from %s failed: %s", client->target_addr, uv_strerror(nread));
        }
        close_client(client);
        close_remote(remote);
    }
}
开发者ID:nsdown,项目名称:xsocks-1,代码行数:30,代码来源:xsocksd_remote.c


示例18: client_recv_cb

static void
client_recv_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
    struct client_context *client = stream->data;
    struct remote_context *remote = client->remote;
    int clen;

    if (nread > 0) {
        reset_timer(remote);
        uv_read_stop(&client->handle.stream);

        switch (client->stage) {
        case XSTAGE_HANDSHAKE:
            if (verify_methods(buf->base, nread)) {
                handshake(client);
            } else {
                logger_log(LOG_ERR, "invalid method packet");
                close_client(client);
                close_remote(remote);
            }

            break;

        case XSTAGE_REQUEST:
            if (verify_request(buf->base, nread)) {
                request_start(client, buf->base);
            } else {
                logger_log(LOG_ERR, "invalid request packet");
                close_client(client);
                close_remote(remote);
            }

            break;

        case XSTAGE_FORWARD:
            clen = nread + PRIMITIVE_BYTES;
            uint8_t *c = client->buf + HEADER_BYTES;
            int rc = crypto_encrypt(c, (uint8_t*)buf->base, nread);
            if (rc) {
                logger_log(LOG_ERR, "encrypt failed");
                close_client(client);
                close_remote(remote);
            }
            forward_to_remote(remote, c, clen);

            break;

        default:
            break;
        }

    } else if (nread < 0) {
        if (nread != UV_EOF) {
            char addrbuf[INET6_ADDRSTRLEN + 1] = {0};
            uint16_t port = ip_name(&client->addr, addrbuf, sizeof addrbuf);
            logger_log(LOG_ERR, "receive from %s:%d failed: %s", addrbuf, port, uv_strerror(nread));
        }
        close_client(client);
        close_remote(remote);
    }
}
开发者ID:road0001,项目名称:xsocks,代码行数:60,代码来源:xsocks_client.c


示例19: uploadable_page_put

UP_STATUS ICACHE_FLASH_ATTR uploadable_page_put(const char *data, unsigned int data_len) {
    if(mBuffer == NULL)
        return UP_STATUS_WRONG_CALL;
    if(mFlashingSector > UPLOADABLE_PAGE_END_SECTOR)
        return UP_STATUS_OVERFLOW;
    reset_timer();

    ETS_INTR_LOCK();
    while(data_len) {
        uint32_t tocopy = (data_len > (SPI_FLASH_SEC_SIZE - mBufferPos)) ?
                          (SPI_FLASH_SEC_SIZE - mBufferPos): data_len;
        os_memcpy(&mBuffer[mBufferPos], data, tocopy);
        mBufferPos += tocopy;
        data_len -= tocopy;
        data += tocopy;
        if(mBufferPos == SPI_FLASH_SEC_SIZE) {
            SpiFlashOpResult res = flash_data();
            mBufferPos = 0;
            if(res != SPI_FLASH_RESULT_OK) {
                ETS_INTR_UNLOCK();
                dhdebug("Error while writing page at 0x%X",
                        mFlashingSector * SPI_FLASH_SEC_SIZE);
                return UP_STATUS_INTERNAL_ERROR;
            }
        }
    }
    ETS_INTR_UNLOCK();
    return UP_STATUS_OK;
}
开发者ID:devicehive,项目名称:esp8266-firmware,代码行数:29,代码来源:uploadable_page.c


示例20: setup_timer

static void setup_timer(mfp_timer_t * const ptimer, int idx, bogoc68_t bogoc)
{
  ptimer->def     = timer_def[idx&3];
  ptimer->tdr_res = 256;
  ptimer->tdr_cur = ptimer->tdr_res;
  reset_timer(ptimer, bogoc);
}
开发者ID:slippyex,项目名称:OSME,代码行数:7,代码来源:mfpemul.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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