Example #1
0
/*!	Creates the pre-defined user timers for the given team.

	\param team The team whose pre-defined timers shall be created.
	\return \c B_OK, when everything when fine, another error code otherwise.
*/
status_t
user_timer_create_team_timers(Team* team)
{
	// create a real time user timer
	struct sigevent event;
	event.sigev_notify = SIGEV_SIGNAL;
	event.sigev_signo = SIGALRM;

	int32 timerID = create_timer(CLOCK_MONOTONIC, USER_TIMER_REAL_TIME_ID,
		team, NULL, 0, event, NULL, true);
	if (timerID < 0)
		return timerID;

	// create a total CPU time user timer
	event.sigev_notify = SIGEV_SIGNAL;
	event.sigev_signo = SIGPROF;

	timerID = create_timer(CLOCK_PROCESS_CPUTIME_ID,
		USER_TIMER_TEAM_TOTAL_TIME_ID, team, NULL, 0, event, NULL, true);
	if (timerID < 0)
		return timerID;

	// create a user CPU time user timer
	event.sigev_notify = SIGEV_SIGNAL;
	event.sigev_signo = SIGVTALRM;

	timerID = create_timer(CLOCK_PROCESS_USER_CPUTIME_ID,
		USER_TIMER_TEAM_USER_TIME_ID, team, NULL, 0, event, NULL, true);
	if (timerID < 0)
		return timerID;

	return B_OK;
}
Example #2
0
static void
reschedule (struct serial *scb)
{
  if (serial_is_async_p (scb))
    {
      int next_state;

      switch (scb->async_state)
	{
	case FD_SCHEDULED:
	  if (scb->bufcnt == 0)
	    next_state = FD_SCHEDULED;
	  else
	    {
	      delete_file_handler (scb->fd);
	      next_state = create_timer (0, push_event, scb);
	    }
	  break;
	case NOTHING_SCHEDULED:
	  if (scb->bufcnt == 0)
	    {
	      add_file_handler (scb->fd, fd_event, scb);
	      next_state = FD_SCHEDULED;
	    }
	  else
	    {
	      next_state = create_timer (0, push_event, scb);
	    }
	  break;
	default: /* TIMER SCHEDULED */
	  if (scb->bufcnt == 0)
	    {
	      delete_timer (scb->async_state);
	      add_file_handler (scb->fd, fd_event, scb);
	      next_state = FD_SCHEDULED;
	    }
	  else
	    next_state = scb->async_state;
	  break;
	}
      if (serial_debug_p (scb))
	{
	  switch (next_state)
	    {
	    case FD_SCHEDULED:
	      if (scb->async_state != FD_SCHEDULED)
		fprintf_unfiltered (gdb_stdlog, "[fd%d->fd-scheduled]\n",
				    scb->fd);
	      break;
	    default: /* TIMER SCHEDULED */
	      if (scb->async_state == FD_SCHEDULED)
		fprintf_unfiltered (gdb_stdlog, "[fd%d->timer-scheduled]\n",
				    scb->fd);
	      break;
	    }
	}
      scb->async_state = next_state;
    }
}
Example #3
0
NPC* construct_NPC( int _xInMatrix, int _yInMatrix )
{
    NPC* p_temp_npc = (NPC*)malloc( sizeof( NPC ) );

    // load all 12 frames of the pacmen
    p_temp_npc->NPC_up_frames    = (void**)malloc( GC_NPC_frames * sizeof( void* ) );

    p_temp_npc->NPC_right_frames = (void**)malloc( GC_NPC_frames * sizeof( void* ) );

    p_temp_npc->NPC_down_frames  = (void**)malloc( GC_NPC_frames * sizeof( void* ) );

    p_temp_npc->NPC_left_frames  = (void**)malloc( GC_NPC_frames * sizeof( void* ) );

    int i;
    for ( i = 0; i < GC_NPC_frames; i++ )
        p_temp_npc->NPC_up_frames[i] = load_image( GC_pac_man_up_frames[i], GC_block_size, GC_block_size );

    for ( i = 0; i < GC_NPC_frames; i++ )
        p_temp_npc->NPC_right_frames[i] = load_image( GC_pac_man_right_frames[i], GC_block_size, GC_block_size );

    for ( i = 0; i < GC_NPC_frames; i++ )
        p_temp_npc->NPC_down_frames[i] = load_image( GC_pac_man_down_frames[i], GC_block_size, GC_block_size );

    for ( i = 0; i < GC_NPC_frames; i++ )
        p_temp_npc->NPC_left_frames[i] = load_image( GC_pac_man_left_frames[i], GC_block_size, GC_block_size );

    // set the first frame to be active
    p_temp_npc->up_frame_index    = 0;
    p_temp_npc->right_frame_index = 0;
    p_temp_npc->down_frame_index  = 0;
    p_temp_npc->left_frame_index  = 0;

    p_temp_npc->left = _xInMatrix * GC_block_size;

    p_temp_npc->top = _yInMatrix * GC_block_size + GC_y_offset;

    p_temp_npc->direction = rand() % 4;

    p_temp_npc->alive = 1;

    // initalize NPC artificial inteligence
    // p_temp_npc->p_NPC_AI = NPC_random_walk_AI;

    p_temp_npc->walk_timer  = create_timer( GC_NPC_walk_duration );

    p_temp_npc->AI_timer    = create_timer( GC_NPC_AI_delay );

    p_temp_npc->frame_timer = create_timer( GC_NPC_frames_duration );

    return p_temp_npc;
}
Example #4
0
void setup() {
        setup_screen();
        player = create_sprite(screen_width()/2, screen_height() - 5, 1, 1, "S");
        player->dy = 0;
        player->dx = 0;
 
        bullet = create_sprite(-1, -1, 1, 1, "*");
        bullet->dy = 0;
        bullet->dx = 0;
 
for (int i = 0; i < 3; i++) {
                alien[i] = create_sprite(4+4*i, 0, 1, 1, "@");
        }
for (int j = 0; j < 4; j++) {
                alien[j+3] = create_sprite(2+4*j, 3, 1, 1, "@");
        }
for (int k = 0; k < 3; k++) {
                alien[k+7] = create_sprite(4+4*k, 6, 1, 1, "@");
        }      
for (int r = 0; r < 10; r++) {
        alien[r]->dx = 0.1;
        alien[r]->dy = 0;
}
 
 
        tim = create_timer(25);
}
void start_scan_sambaserver(int use_sys_timer)
{
	//- Remove all
	smb_srv_info_t *c;
	for (c = smb_srv_info_list; c; c = c->next) {
		Cdbg(DBE, "remove , ip=[%s]\n", c->ip->ptr);
		DLIST_REMOVE(smb_srv_info_list,c);
		free(c);
		c = smb_srv_info_list;
	}
	free(smb_srv_info_list);
	
	init_a_srvInfo();

	g_useSystemTimer = use_sys_timer;
	g_bInitialize = 1;
	
#ifdef _USEMYTIMER
	if(g_useSystemTimer==0){
		Cdbg(DBE, "create timer\n");
		timer_t arp_timer = create_timer(TT_SIGUSR2);
    	install_sighandler(TT_SIGUSR2, on_arpping_timer_handler);
    	set_timer(arp_timer, ARP_TIME_INTERVAL);
	}
#endif
}
Example #6
0
LRESULT StatsFrame::onCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
	// [+]IRainman
	//DownloadManager::getInstance()->addListener(this);
	//UploadManager::getInstance()->addListener(this);
	// [~]IRainman
	
	create_timer(1000);
	
	SetFont(Fonts::g_font);
	
	bHandled = FALSE;
#ifdef FLYLINKDC_USE_SHOW_UD_RATIO
	
	ctrlRatio.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS, WS_EX_CLIENTEDGE, IDC_UD_RATIO);
	ratioContainer.SubclassWindow(ctrlRatio);
	SET_EXTENDENT_LIST_VIEW_STYLE(ctrlRatio);
	SET_LIST_COLOR(ctrlRatio);
	
	BOOST_STATIC_ASSERT(_countof(columnSizes) == COLUMN_LAST);
	BOOST_STATIC_ASSERT(_countof(columnNames) == COLUMN_LAST);
	
	for (uint8_t j = 0; j < COLUMN_LAST; j++)
	{
		ctrlRatio.InsertColumn(j, CTSTRING_I(columnNames[j]), LVCFMT_LEFT, columnSizes[j], j);
	}
#endif
	return 1;
}
Example #7
0
void
init_video (void)
{
  if (! al_init_image_addon ())
    error (-1, 0, "%s (void): failed to initialize image addon",
            __func__);

  al_set_new_display_flags (al_get_new_display_flags ()
                            | (display_mode < 0 ? ALLEGRO_WINDOWED : ALLEGRO_FULLSCREEN)
                            | ALLEGRO_RESIZABLE
                            | ALLEGRO_GENERATE_EXPOSE_EVENTS);

  display_width = display_width ? display_width : DISPLAY_WIDTH;
  display_height = display_height ? display_height : DISPLAY_HEIGHT;

  if (display_mode >= 0) {
    ALLEGRO_DISPLAY_MODE d;
    get_display_mode (display_mode, &d);
    display_width = d.width;
    display_height = d.height;
    al_set_new_display_refresh_rate (d.refresh_rate);
    al_set_new_display_flags (al_get_new_display_flags ()
                              & ~ALLEGRO_FULLSCREEN_WINDOW);
  }

  al_set_new_display_option (ALLEGRO_SINGLE_BUFFER, 1, ALLEGRO_SUGGEST);

  display = al_create_display (display_width, display_height);
  if (! display) error (-1, 0, "%s (void): failed to initialize display", __func__);

  set_target_backbuffer (display);
  al_set_new_bitmap_flags (ALLEGRO_VIDEO_BITMAP);

  al_set_window_title (display, WINDOW_TITLE);
  icon = load_bitmap (ICON);
  al_set_display_icon (display, icon);

  cutscene = true;
  if (mr.fit_w == 0 && mr.fit_h == 0) {
    mr.fit_w = 2;
    mr.fit_h = 2;
  }
  set_multi_room (1, 1);
  effect_buffer = create_bitmap (CUTSCENE_WIDTH, CUTSCENE_HEIGHT);
  black_screen = create_bitmap (CUTSCENE_WIDTH, CUTSCENE_HEIGHT);
  uscreen = create_bitmap (CUTSCENE_WIDTH, CUTSCENE_HEIGHT);
  iscreen = create_bitmap (display_width, display_height);
  clear_bitmap (uscreen, TRANSPARENT_COLOR);

  video_timer = create_timer (1.0 / EFFECT_HZ);

  al_init_font_addon ();
  builtin_font = al_create_builtin_font ();
  if (! builtin_font)
    error (-1, 0, "%s (void): cannot create builtin font", __func__);

  if (! al_init_primitives_addon ())
    error (-1, 0, "%s (void): failed to initialize primitives addon",
           __func__);
}
Example #8
0
struct callout_handle
timeout(timer_function func, void *cookie, bigtime_t timeout)
{
	struct callout_handle handle;
	handle.timer = create_timer(func, cookie, timeout, B_ONE_SHOT_RELATIVE_TIMER);
	return handle;
}
Example #9
0
int main(int argc, char const *argv[])
{
    char err[SOCKET_ERR_LEN];

    pool = buffer_pool_create(100);
    prev_recv = prev_send = 0;
    recv_total = send_total = 0;

    int sfd = tcp_server_serve(err, "localhost", 3456, SOMAXCONN);
    if (sfd < 0) {
        printf("%d %s\n", sfd, err);
        return 0;
    }

    if (set_nonblock(err, sfd) != 0) {
        printf("%s\n", err);
        return 0;
    }

    if (set_tcp_nodelay(err, sfd, 1) != 0) {
        printf("%s\n", err);
        return 0;
    }

    event_loop_t *loop = event_loop_create(100, 10);
    assert(loop != NULL);

    create_timer(loop, 1000, print_info, NULL);
    create_event(loop, sfd, EV_RDABLE, server_accept_cb, NULL);

    event_loop_start(loop);
}
Example #10
0
void app_pic_play_timer_reset(void)
{
	if (reset_timer(sp_PicPlayTimer) != 0)
	{
		sp_PicPlayTimer = create_timer(picasa_pic_play_timeout, 5000, NULL, TIMER_ONCE);
	}
}
Example #11
0
int main(int argc, char**argv){
	char * evar = getenv("RELY_SRAND_DATA");
	if(evar != NULL) srand(atoi(evar));
	else srand(0);
	
	if(argc <= 3){
		printf("USAGE: scale FACTOR INPUT OUTPUT\n");
		return 1;
	}
	inst_timer GLOBAL_TIMER = create_timer();
	start_timer(&GLOBAL_TIMER);
	double scale_factor = atof(argv[1]);
	char* in_filename = argv[2];
	char * out_filename = argv[3];
	printf("scale by %f: %s -> %s\n", scale_factor, in_filename, out_filename);

    int* src, * transformed;

	size_t sw, sh, dw, dh;
	printf("read from \"%s\" ...\n", in_filename);
	src = read_image(in_filename, &sw, &sh);
	if(src == NULL){
		fprintf(stderr, ">> Failed to read image %s\n", in_filename);
		exit(1);
	}
	transformed = allocate_transform_image(scale_factor, sw, sh, &dw, &dh);
	scale(scale_factor, src, sw, sh, transformed, dw, dh);
	printf("write to \"%s\" ...\n", out_filename);
	write_image(out_filename, transformed, dw, dh);
	free((void *) src);
	free((void *) transformed);
	end_timer(&GLOBAL_TIMER);
	printf("GLOBAL TIME\n");
	print_timer(&GLOBAL_TIMER);
}
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;
}
/**
 * \callgraph
 *\brief 	Initialize the blocks of flash memory used for reading/writing.
 *\details	Uses Nordic's pstorage software abstraction/API to cleanly access flash when the SoftDevice (for BLE)
 *		is also running.
 */
void ladybug_flash_init() {
  SEGGER_RTT_WriteString(0,"==> IN ladybug_flash_init\n");
  pstorage_module_param_t pstorage_param;   //Used when registering with pstorage
  pstorage_handle_t	  handle;	    //used to access the chunk-o-flash requested when registering
  //First thing is to initialize pstorage
  uint32_t err_code = pstorage_init();
  //if initialization was not successful, the error routine will be called and the code won't proceed.
  APP_ERROR_CHECK(err_code);
  //Next is to register amount of flash needed.  The smallest amount that can be requested is 16 bytes.  I'm requesting
  //32 bytes because this is the number of bytes needed for plant_info. Two blocks are used...one for plant info and one for hydro values.  I must make a
  //block request for the larger amount of bytes
  pstorage_param.block_size = BLOCK_SIZE;
  //request three blocks - one will be for pH, one for plant_info, and one for device name
  pstorage_param.block_count = 3;
  //assign a callback so know when a command has finished.
  pstorage_param.cb = ladybug_flash_handler;
  err_code = pstorage_register(&pstorage_param, &handle);
  APP_ERROR_CHECK(err_code);
  //Then get the handles to the blocks of flash
  pstorage_block_identifier_get(&handle, 0, &m_block_calibration_store_handle);
  pstorage_block_identifier_get(&handle,1,&m_block_plantInfo_store_handle);
  pstorage_block_identifier_get(&handle,2,&m_block_device_name_store_handle);
  // Create the timer.  This will be called before a Flash activity is requested to avoid forever hanging.
  create_timer();

}
Example #14
0
/*
 * Program timer to remove referral cache entry after TTL
 * If the timer was already programed, it reprogram it with the new time to expiry
 */
void program_referral_expiry_timer(lispd_referral_cache_entry *referral_entry)
{
    if (referral_entry->expiry_ddt_cache_timer == NULL){
        referral_entry->expiry_ddt_cache_timer = create_timer(DDT_EXPIRE_MAP_REFERRAL);
    }
    start_timer(referral_entry->expiry_ddt_cache_timer, referral_entry->ttl*60, referral_expiry, (void *)referral_entry);
}
Example #15
0
void setup_score(Game* game) {
	if (NULL != game) {
		game->score = 0;
		game->over = false;
		game->timer = create_timer(INTERVAL);
	}
}
Example #16
0
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);
	}
}
Example #17
0
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);
	}
}
Example #18
0
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;
}
void youtube_play_update_timer_reset(void)
{
	if (reset_timer(sp_YoutubePlayUpdateTimer) != 0)
	{
		sp_YoutubePlayUpdateTimer = create_timer(youtube_play_update, 1000, NULL, TIMER_REPEAT);
	}
}
Example #20
0
int send_map_request_miss(timer *t, void *arg)
{
    timer_map_request_argument *argument = (timer_map_request_argument *)arg;
    lispd_map_cache_entry *map_cache_entry = argument->map_cache_entry;
    nonces_list *nonces = map_cache_entry->nonces;
    lisp_addr_t *dst_rloc = NULL;

    if (nonces == NULL){
        nonces = new_nonces_list();
        if (nonces==NULL){
            lispd_log_msg(LISP_LOG_WARNING,"Send_map_request_miss: Unable to allocate memory for nonces.");
            return (BAD);
        }
        map_cache_entry->nonces = nonces;
    }

    if (nonces->retransmits - 1 < map_request_retries ){

        if (map_cache_entry->request_retry_timer == NULL){
            map_cache_entry->request_retry_timer = create_timer (MAP_REQUEST_RETRY_TIMER);
        }

        if (nonces->retransmits > 0){
            lispd_log_msg(LISP_LOG_DEBUG_1,"Retransmiting Map Request for EID: %s (%d retries)",
                    get_char_from_lisp_addr_t(map_cache_entry->mapping->eid_prefix),
                    nonces->retransmits);
        }

        /* Get the RLOC of the Map Resolver to be used */
        dst_rloc = get_map_resolver();

        if ((dst_rloc == NULL) || (build_and_send_map_request_msg(
                map_cache_entry->mapping,
                &(argument->src_eid),
                dst_rloc,
                1,
                0,
                0,
                0,
                &nonces->nonce[nonces->retransmits]))==BAD){
            lispd_log_msg (LISP_LOG_DEBUG_1, "send_map_request_miss: Couldn't send map request for a new map cache entry");

        }

        nonces->retransmits ++;
        start_timer(map_cache_entry->request_retry_timer, LISPD_INITIAL_MRQ_TIMEOUT,
                send_map_request_miss, (void *)argument);

    }else{
        lispd_log_msg(LISP_LOG_DEBUG_1,"No Map Reply fot EID %s/%d after %d retries. Removing map cache entry ...",
                        get_char_from_lisp_addr_t(map_cache_entry->mapping->eid_prefix),
                        map_cache_entry->mapping->eid_prefix_length,
                        nonces->retransmits -1);
        del_map_cache_entry_from_db(map_cache_entry->mapping->eid_prefix,
                map_cache_entry->mapping->eid_prefix_length);

    }
    return GOOD;
}
Example #21
0
/*
 ******************************************************************************
 * dgadmin_rest_sync_main --                                                  *//**
 *
 * \brief This routine periodically starts sync circle.
 *
 * \param [in] pDummy	Not used.
 *
 * \retval None
 *
 *****************************************************************************/
static void dgadmin_rest_sync_main(UINT1 *pDummy)
{
    unsigned int 			listenEvent   = 0;
    unsigned int 			recvEvent     = 0;

    if (sem_give(gDgwySyncSemId) != OSW_OK) 
	{
		return;
    }
    if (create_queue("RSYNC", OSW_MAX_Q_MSG_LEN, 10, &gDgwySyncMsgId) != OSW_OK)
    {
        printf("%s:error when create queue\n",__FUNCTION__);
        return;
    }

    if (create_timer("RSTASK", DGWY_SYNC_TASK_TIMER_EVENT,
                     NULL, 0, &gDgwySyncTimerListId) != OSW_OK) 
    {
        printf("%s:error when create_timer\n",__FUNCTION__);
        return;
    }

    /* start the timer */
    start_timer(gDgwySyncTimerListId, DGADMIN_REST_SYNC_INTERVAL, 0);

    listenEvent = DGWY_SYNC_TASK_TIMER_EVENT;/* | DGWY_SYNC_TASK_MSG_EVENT; */

    log_info(ServiceUtilLogLevel,
             "INIT REST SYNC TASK ");

	while (1) 
    {
        if(recv_event(gDgwySyncTaskId, listenEvent, OSW_NO_WAIT, &recvEvent) == OSW_ERROR)
        {
            sleep(10);
            continue;
        }
    
        log_debug(ServiceUtilLogLevel,"recvEvent %d\n",
                  recvEvent);

        if(recvEvent & DGWY_SYNC_TASK_TIMER_EVENT)
        {
            if(g_dgw_role)
            {
                /* Try to be in sync with DMC */
                log_notice(ServiceUtilLogLevel,
                           "SYNC START: version %d\n", 
                           g_dgwconfig_curversion);
                dgadmin_rest_sync_process();
                log_notice(ServiceUtilLogLevel,
                           "SYNC END : version %d\n",
                           g_dgwconfig_curversion);
            }
            start_timer(gDgwySyncTimerListId, DGADMIN_REST_SYNC_INTERVAL, 0);
        }
        
    }
}
Example #22
0
static void pvr_timer_start(pvr_timer *timer, pvr_timer_mode mode)
{
    if(0 != reset_timer(timer->timer[mode]))
    {
        timer->timer[mode] = create_timer(timer->cb[mode], 
        timer->interval[mode], NULL, timer->flag[mode]); 
    }
}
Example #23
0
/**
 * trigger the timer for each process
 */
void start_timers()
{
	int i;

	for (i = 0; i < PROCESS_NUM; i++) {
		timers[i] = create_timer(i, TIMEOUT_TIME, timeout);
	}
}
Example #24
0
void app_pic_play_gif_timer_reset(void)
{
	if (reset_timer(sp_GifUpdateTimer) != 0)
	{
		sp_GifUpdateTimer = create_timer(picasa_pic_play_gif_timeout, 
			100, NULL, TIMER_REPEAT);
	}
}
void gif_start(void)
{
	app_youtube_play_show_gif();
	
	if (reset_timer(sp_YoutubePlayGifTimer) != 0)
	{
		sp_YoutubePlayGifTimer = create_timer(youtube_play_draw_gif_proc, 50, NULL, TIMER_REPEAT);
	}
}
SIGNAL_HANDLER  int app_factory_menu_dplay_create(const char* widgetname, void *usrdata)
{

	factory_update_cur_program_info();
	spApp_fatory_time_dplay = create_timer(fatory_menu_dplay_time, 500, NULL,  TIMER_REPEAT);


	return 0;

}
Example #27
0
void
system::create_one_off_timer( timer::time_point when, const std::function<void(void)> &e )
{
	precondition( e, "Invalid function for one off timer" );
	auto t = create_timer();
	t->elapsed = std::bind( &system::dispatch_oneoff_timer, this, t, e );
	t->reset_one_off( when );
	t->activate( true );
	get_dispatcher()->add_waitable( t );
}
static void tr_cas_ippt_mark_timer_start(void)
{
	if (pIpptMarkFlushTimerHdl != NULL)
	{
		remove_timer(pIpptMarkFlushTimerHdl);
		pIpptMarkFlushTimerHdl = NULL;	
	}
	
	pIpptMarkFlushTimerHdl = create_timer(tr_cas_timer_ippt_mark_flush,\
		   			   						4000, NULL, TIMER_ONCE);
	return;
}
Example #29
0
void process_link_status_change(
    lispd_iface_elt     *iface,
    int                 new_status)
{
    if (iface->status == new_status) {
        lispd_log_msg(LISP_LOG_DEBUG_2,"process_link_status_change: The detected change of status doesn't affect");
        return;
    }

    if (iface->status_changed == TRUE) {
        iface->status_changed = FALSE;
    } else {
        iface->status_changed = TRUE;
    }

    // Change status of the interface
    iface->status = new_status;

    /*
     * If the affected interface is the default control or output iface, recalculate it
     */

    if (default_ctrl_iface_v4 == iface
            || default_ctrl_iface_v6 == iface
            || default_ctrl_iface_v4 == NULL
            || default_ctrl_iface_v6 == NULL) {
        lispd_log_msg(LISP_LOG_DEBUG_2,"Default control interface down. Recalculate new control interface");
        set_default_ctrl_ifaces();
    }

    if (default_out_iface_v4 == iface
            || default_out_iface_v6 == iface
            || default_out_iface_v4 == NULL
            || default_out_iface_v6 == NULL) {
        lispd_log_msg(LISP_LOG_DEBUG_2,"Default output interface down. Recalculate new output interface");
        set_default_output_ifaces();
    }
    iface_balancing_vectors_calc(iface);

    /* When NAT aware, if address has change when interface down, when UP init info request process */
    if(new_status == UP && nat_aware==TRUE && nat_aware_iface_address_change == TRUE) {
        initial_info_request_process();
        nat_aware_iface_address_change = FALSE;
    }

    /* Reprograming SMR timer*/
    if (smr_timer == NULL) {
        smr_timer = create_timer (SMR_TIMER);
    }

    start_timer(smr_timer, LISPD_SMR_TIMEOUT,(timer_callback)init_smr, NULL);

}
Example #30
0
static status_t pic_box_timer_start(void)
{
	if(pic_box_hide_timer)
	{	
		reset_timer(pic_box_hide_timer);	
	}
	else
	{
		pic_box_hide_timer = create_timer(pic_box_hide, 5000, 0, TIMER_ONCE);
	}
	return GXCORE_SUCCESS;
}