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


C++ remove_timer函数代码示例

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


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

示例1: checktimers

void checktimers(time_t time) {
    timer *timer, *next;
    void *arg;
    tmrhandler_t func;

    for (timer = timers; timer; timer = next) {
        next = timer->next;

        if (timer->exectime > 0 && timer->exectime <= time) {
            arg = timer->arg;
            func = timer->handler;

            func(arg);

            switch (timer->type) {
                case TIMER_ONCE:
                    remove_timer(timer);
                    break;
                case TIMER_RECURRING:
                    /* Extend the time */
                    timer->exectime += timer->interval;
                    break;
            }
        }

        if (!timer->exectime)
            remove_timer(timer);
    }

}
开发者ID:rdgout,项目名称:ircbot,代码行数:30,代码来源:timer.c

示例2: system_shell_timeout

static int system_shell_timeout(void *userdata)
{
    struct shell_call_param* p_call_param = NULL;

    p_call_param = (struct shell_call_param*)userdata;

	if((p_call_param != s_plast_call_param) || (s_plast_call_param == NULL))
	{
		printf("time param error p_call=%p,plast_call=%p\n",p_call_param,s_plast_call_param);
		return 0;
	}

    p_call_param->time_out--;
    if(p_call_param->time_out > 0)
    {
	//WNOHANG pid子进程即使未结束也返回0
	if(waitpid(p_call_param->pid, &g_system_shell_ret_status, WNOHANG) == 0)
	{
	    if(p_call_param->step_proc)
		p_call_param->step_proc(p_call_param->userdata);
	}
	else
	{
	    s_plast_call_param = NULL;
		remove_timer(p_call_param->p_Timer);
	    if(p_call_param->finsh_proc)
		p_call_param->finsh_proc(p_call_param->userdata);
	    
	    
	    GxCore_Free(p_call_param);
	}
    }
    else
    {
		s_plast_call_param = NULL;
		kill(p_call_param->pid, SIGKILL);
		remove_timer(p_call_param->p_Timer);

	if(p_call_param->finsh_proc)
		p_call_param->finsh_proc(p_call_param->userdata);
	    
		
		GxCore_Free(p_call_param);
    }
    

    return 0;
}
开发者ID:github188,项目名称:GX3113C_JIMO,代码行数:48,代码来源:app_linux_update.c

示例3: ShutdownTimer

void ShutdownTimer() {
	if (!installed) return;

	remove_int(_maped_timer_handler);
	remove_timer();
	installed=false;
}
开发者ID:mcgrue,项目名称:maped2w,代码行数:7,代码来源:TIMER.cpp

示例4: update_system_timer

int	update_system_timer (const char *entry)
{
	int	i;
	int	all = 0;

	if (entry == NULL)
		all = 1;

	for (i = 0; system_timers[i].name; i++)
	{
	    if (all == 1 || !strcmp(system_timers[i].name, entry))
	    {
		/* This needs to be set before calling 'system_timer' */
		get_time(&now);

		if (get_int_var(*system_timers[i].toggle_variable) &&
		    get_int_var(*system_timers[i].interval_variable))
			system_timer(&system_timers[i]);
		else
		{
		    if (timer_exists(system_timers[i].name))
			remove_timer(system_timers[i].name);
		}

		if (all == 0)
			return 0;
	    }
	}

	if (all == 1)
		return 0;

	return -1;
}
开发者ID:Cloudxtreme,项目名称:epic5,代码行数:34,代码来源:clock.c

示例5: pthread_cond_timedwait

int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
			   unsigned long abstime) {
    waitqueue_t entry;
    timer_t timer = { 0,  (void (*)(void*)) make_running, ctid };
    tid_t owner;
    int result = 0;
    // check if mutex is available, if not, go to sleep
    grab_kernel_lock();

    entry.thread = ctid;
    add_to_waitqueue(&cond->waiters, &entry);
    pthread_mutex_unlock(mutex);
    if (abstime)
	add_timer(abstime - get_system_up_time(), &timer);

    wait();
    if (abstime) {
	if (get_timer_count(timer))
	    remove_timer(&timer);
	else
	    result = ETIMEDOUT;
    }
    remove_from_waitqueue(&entry);
    pthread_mutex_lock(mutex);
    return 0;
}
开发者ID:jschiefer,项目名称:bibo,代码行数:26,代码来源:mutex.c

示例6: clock_exit

  ~Alleg4System() {
    clock_exit();
    remove_timer();
    allegro_exit();

    g_instance = nullptr;
  }
开发者ID:riggtravis,项目名称:aseprite,代码行数:7,代码来源:she.cpp

示例7: start_timer_int

/* Internal version of start_timer that does not protect itself, assuming this has already been done.
 * Otherwise does as explained above in start_timer.
 */
STATICFNDEF void start_timer_int(TID tid, int4 time_to_expir, void (*handler)(), int4 hdata_len, void *hdata)
{
	ABS_TIME at;

 	assert(0 != time_to_expir);
	sys_get_curr_time(&at);
	if (first_timeset)
	{
		init_timers();
		first_timeset = FALSE;
	}
	/* We expect no timer with id=<tid> to exist in the timer queue currently. This is asserted in "add_timer" call below.
	 * In pro though, we'll be safe and remove any tids that exist before adding a new entry with the same tid - 2009/10.
	 * If a few years pass without the assert failing, it might be safe then to remove the PRO_ONLY code below.
	 */
#	ifndef DEBUG
	if (timeroot && (timeroot->tid == tid))
		sys_canc_timer();
	remove_timer(tid); /* Remove timer from chain */
#	endif
	/* Check if # of free timer slots is less than minimum threshold. If so, allocate more of those while it is safe to do so */
	if ((GT_TIMER_EXPAND_TRIGGER > num_timers_free) && (1 > timer_stack_count))
		gt_timers_alloc();
	add_timer(&at, tid, time_to_expir, handler, hdata_len, hdata);	/* Link new timer into timer chain */
	if ((timeroot->tid == tid) || !timer_active)
		start_first_timer(&at);
}
开发者ID:ztmr,项目名称:fis-gtm-openindiana,代码行数:30,代码来源:gt_timers.c

示例8: erts_cancel_timer

void
erts_cancel_timer(ErlTimer* p)
{
    erts_smp_mtx_lock(&tiw_lock);
    if (!p->active) { /* allow repeated cancel (drivers) */
	erts_smp_mtx_unlock(&tiw_lock);
	return;
    }

    /* is it the 'min' timer, remove min */
    if (p == tiw_min_ptr) {
	tiw_min_ptr = NULL;
	tiw_min     = 0;
    }

    remove_timer(p);
    p->slot = p->count = 0;

    if (p->cancel != NULL) {
	erts_smp_mtx_unlock(&tiw_lock);
	(*p->cancel)(p->arg);
	return;
    }
    erts_smp_mtx_unlock(&tiw_lock);
}
开发者ID:1153,项目名称:otp,代码行数:25,代码来源:time.c

示例9: app_tr_cas_osd_roll_timer_check

void app_tr_cas_osd_roll_timer_check(void)
{
	if (FALSE == s_bOsdRollEnable)
	{
		return;	
	}
	
	GxCore_SemWait(s_semNotifyRoll);
	
	if (s_rollingInfo.period > 0)
	{
		printf("[app_tr_cas_osd_roll_timer_check]Create Roll(%ds) Timer>>>+++.\n",\
			  		s_rollingInfo.period);

		if (s_rollingInfo.timer_handle)
		{
			remove_timer(s_rollingInfo.timer_handle);
			s_rollingInfo.timer_handle = NULL;
		}
		
		s_rollingInfo.timer_handle = create_timer(tr_cas_timer_roll,\
			   									  s_rollingInfo.period*1000,\
			   			   						  NULL, TIMER_ONCE);
	}
	
	GxCore_SemPost(s_semNotifyRoll);
	return;
}
开发者ID:github188,项目名称:GX3113C_JIMO,代码行数:28,代码来源:app_tr_cas_porting_stb_api.c

示例10: execute_callback

/**
 * Execute the callback of a timer.
 *
 * @param expiredTimer pointer on the timer
 *
 * WARNING: expiredTimer MUST NOT be null (rem: static function )
 */
static void execute_callback(T_TIMER_LIST_ELT *expiredTimer)
{
#ifdef __DEBUG_OS_ABSTRACTION_TIMER
	_log(
		"\nINFO : execute_callback : executing callback of timer 0x%x  (now = %u - expiration = %u)",
		(uint32_t)expiredTimer,
		get_uptime_ms(), expiredTimer->desc.expiration);
#endif
	int flags = irq_lock();

	/* if the timer was not stopped by its own callback */
	if (E_TIMER_RUNNING == expiredTimer->desc.status) {
		remove_timer(expiredTimer);
		/* add it again if repeat flag was on */
		if (expiredTimer->desc.repeat) {
			expiredTimer->desc.expiration = get_uptime_ms() +
							expiredTimer->desc.
							delay;
			add_timer(expiredTimer);
		}
	}
	irq_unlock(flags);

	/* call callback back */
	if (NULL != expiredTimer->desc.callback) {
		expiredTimer->desc.callback(expiredTimer->desc.data);
	} else {
#ifdef __DEBUG_OS_ABSTRACTION_TIMER
		_log("\nERROR : execute_callback : timer callback is null ");
#endif
		panic(E_OS_ERR);
	}
}
开发者ID:CurieBSP,项目名称:main,代码行数:40,代码来源:timer.c

示例11: timer_stop

/**
 *  Remove the timer in Chained list of timers.
 *     This service may panic if:
 *         tmr parameter is is null, invalid, or timer is not running.
 *
 * Authorized execution levels:  task, fiber, ISR
 *
 * @param tmr : handler on the timer (value returned by timer_create ).
 *
 */
void timer_stop(T_TIMER tmr)
{
	T_TIMER_LIST_ELT *timer = (T_TIMER_LIST_ELT *)tmr;
	bool doSignal = false;

	if (NULL != timer) {
		int flags = irq_lock();
		/* if timer is active */
		if (timer->desc.status == E_TIMER_RUNNING) {
#ifdef __DEBUG_OS_ABSTRACTION_TIMER
			_log(
				"\nINFO : timer_stop : stopping timer at addr = 0x%x",
				(uint32_t)timer);
#endif
			/* remove the timer */

			if (g_CurrentTimerHead == timer) {
				doSignal = true;
			}

			remove_timer(timer);

			irq_unlock(flags);

			if (doSignal) {
				/* the next timer to expire was removed, unblock timer_task to assess the change */
				signal_timer_task();
			}
		} else { /* tmr is not running */
			irq_unlock(flags);
		}
	} else { /* tmr is not a timer from g_TimerPool_elements */
		panic(E_OS_ERR);
	}
}
开发者ID:CurieBSP,项目名称:main,代码行数:45,代码来源:timer.c

示例12: remove_timer

ttitle_screen::~ttitle_screen()
{
	if(logo_timer_id_) {
		remove_timer(logo_timer_id_);
	}
	delete debug_clock_;
}
开发者ID:asimonov-im,项目名称:wesnoth,代码行数:7,代码来源:title_screen.cpp

示例13: app_jiuzhou_ads_stop

void app_jiuzhou_ads_stop(uint8_t type)
{
		GxAvRect rect;	

		if(type >= AD_JIUZHOU_TYPE_MAX)
		{
			printf("%s type=%d\n",__FUNCTION__,type);	
			return ;
		}
	
		printf("%s file_ddram_path=%s\n",__FUNCTION__,ads_jiuzhou_para[type].file_ddram_path);	
	
		if (NULL != ads_jiuzhou_para[type].ad_timer)
		{
			remove_timer(ads_jiuzhou_para[type].ad_timer);
			ads_jiuzhou_para[type].ad_timer = NULL;
		}

		if (NULL != ads_jiuzhou_para[type].file_ddram_path)
		{
			rect.x = 0;
			rect.y = 0;
			rect.width = VIDEO_WINDOW_W;
			rect.height = VIDEO_WINDOW_H;
			advertisement_clear_frame(rect);			
//			advertisement_clear_frame(ads_jiuzhou_para[type].rectdest);
			memset(&ads_jiuzhou_para[type],0,sizeof(ad_play_para));
//			advertisement_hide();
		}
		
		return ;
}
开发者ID:github188,项目名称:GX3113C_JIMO,代码行数:32,代码来源:app_jiuzhou_ads_bmp.c

示例14: text_view_destroy

SIGNAL_HANDLER int text_view_destroy(const char* widgetname, void *usrdata)
{		
	/*list get*/
	play_list* list = NULL;
	char* path = NULL;
	list = play_list_get(PLAY_LIST_TYPE_TEXT);
	APP_CHECK_P(list, GXCORE_ERROR);
	if(list->play_no >= list->nents) return GXCORE_ERROR;
	path = explorer_static_path_strcat(list->path, list->ents[list->play_no]);
	APP_CHECK_P(path, GXCORE_ERROR);
	
	/*save tag*/
	if(0 < stop_line)
	{
		pmp_save_tag(path, stop_line);
	}

	/*auto roll*/
	if(text_auto_roll_timer)
	{
		remove_timer(text_auto_roll_timer);
		text_auto_roll_timer = NULL;
	}

	app_set_win_destroy_flag(MEDIA_TEXT_WIN);

      return 0;
}
开发者ID:github188,项目名称:GX3113C_JIMO,代码行数:28,代码来源:app_text_view.c

示例15: remove_timer

void tlobby_main::post_show(twindow& /*window*/)
{
	window_ = nullptr;
	remove_timer(lobby_update_timer_);
	lobby_update_timer_ = 0;
	plugins_context_.reset();
}
开发者ID:shikadilord,项目名称:wesnoth,代码行数:7,代码来源:lobby.cpp


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