本文整理汇总了C++中create_timer函数的典型用法代码示例。如果您正苦于以下问题:C++ create_timer函数的具体用法?C++ create_timer怎么用?C++ create_timer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_timer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: user_timer_create_team_timers
/*! 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;
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:38,代码来源:UserTimer.cpp
示例2: reschedule
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;
}
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:59,代码来源:ser-base.c
示例3: construct_NPC
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;
}
开发者ID:c-neves,项目名称:pinky-dinky-doo-revenge,代码行数:51,代码来源:npc.c
示例4: setup
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);
}
开发者ID:micabressan,项目名称:trabajo_final,代码行数:27,代码来源:bue2jsUs.C
示例5: start_scan_sambaserver
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
}
开发者ID:heartshare,项目名称:asuswrt-merlin,代码行数:26,代码来源:~arpping_thread.c
示例6: init_video
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__);
}
开发者ID:oitofelix,项目名称:mininim,代码行数:60,代码来源:video.c
示例7: timeout
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;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:7,代码来源:if_em_osdep.c
示例8: main
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);
}
开发者ID:SerhoLiu,项目名称:libakio,代码行数:32,代码来源:demo.c
示例9: app_pic_play_timer_reset
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);
}
}
开发者ID:github188,项目名称:GX3113C_JIMO,代码行数:7,代码来源:app_picasa.c
示例10: main
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);
}
开发者ID:sarachour,项目名称:topaz,代码行数:35,代码来源:main-instr.cpp
示例11: 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
示例12: ladybug_flash_init
/**
* \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();
}
开发者ID:BitKnitting,项目名称:LadybugLiteBlue_Firmware,代码行数:32,代码来源:Ladybug_Flash.c
示例13: program_referral_expiry_timer
/*
* 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);
}
开发者ID:Alphalink,项目名称:lispmob,代码行数:11,代码来源:lispd_map_referral.c
示例14: setup_score
void setup_score(Game* game) {
if (NULL != game) {
game->score = 0;
game->over = false;
game->timer = create_timer(INTERVAL);
}
}
开发者ID:0xLeon,项目名称:CAB202-Projects,代码行数:7,代码来源:simpletimer.c
示例15: 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
示例16: 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
示例17: _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
示例18: youtube_play_update_timer_reset
void youtube_play_update_timer_reset(void)
{
if (reset_timer(sp_YoutubePlayUpdateTimer) != 0)
{
sp_YoutubePlayUpdateTimer = create_timer(youtube_play_update, 1000, NULL, TIMER_REPEAT);
}
}
开发者ID:kuikuitage,项目名称:GX3113C_HUNAN_DVB,代码行数:7,代码来源:app_youtube_play.c
示例19: send_map_request_miss
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;
}
开发者ID:florincoras,项目名称:lispmob,代码行数:59,代码来源:lispd_map_request.c
示例20: dgadmin_rest_sync_main
/*
******************************************************************************
* 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);
}
}
}
开发者ID:bigclouds,项目名称:opendove,代码行数:70,代码来源:dgadmin_rest_sync.c
注:本文中的create_timer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论