void rim_on_scheduledTask(int id) { int index = id & 0x0000ffff; int uid = id >> 16; RoadMapCallback callback; if (uid != RoadMapMainPeriodicTimer[index].uid) { roadmap_log(ROADMAP_ERROR, "invokelater on old timer! %d:%d", uid, RoadMapMainPeriodicTimer[index].uid); return; } callback = RoadMapMainPeriodicTimer[index].callback; time_t start = NOPH_System_currentTimeMillis(); if (callback != NULL) { last_called_cb = callback; //printf("callback is : 0x%x \n", callback); (*callback) (); } time_t t = NOPH_System_currentTimeMillis() - start; if (t > 1000) { printf("In rim_on_invokeLater, too long! %d 0x%x\n", t, (int)callback); } }
static void cibyl_timer(void) { static int64_t msec; static int cycle_time = 42; // 42 int64_t m, dt; int tx, ty, tw = 0; if (input_mode_show_counter > 0) { input_mode_show_counter--; tw = NOPH_Font_stringWidth(font, input_mode_names[input_mode]); tx = 160 + x_corr; ty = 160 + y_corr; NOPH_Graphics_setColor_int(graphics, 0xffffffff); NOPH_Graphics_fillRect(graphics, tx - 40, ty, 40, 20); NOPH_Graphics_setColor_int(graphics, 0xffdd2222); input_mode_show_counter--; if (input_mode_show_counter > 0) { NOPH_Graphics_drawString(graphics, input_mode_names[input_mode], tx - tw, ty, NOPH_Graphics_TOP | NOPH_Graphics_LEFT); } NOPH_GameCanvas_flushGraphics_rect(canvas, tx - 40, ty, 40, 20); } play_sound(); m = NOPH_System_currentTimeMillis(); dt = m - msec; while (dt < cycle_time) { NOPH_Thread_sleep(cycle_time - dt); m = NOPH_System_currentTimeMillis(); dt = m - msec; } msec = m; }
void roadmap_main_input_ready (int input_id) { int i; for (i = 1; i < ROADMAP_MAX_IO; ++i) { if (RoadMapMainIo[i].input_id == input_id) { time_t start = NOPH_System_currentTimeMillis(); last_called_cb = RoadMapMainIo[i].callback; (*RoadMapMainIo[i].callback)(&RoadMapMainIo[i].io); time_t t = NOPH_System_currentTimeMillis() - start; if (t > 750) { if ( t > 3000 ) roadmap_log(ROADMAP_ERROR,"In roadmap_main_input_ready, too long! %d 0x%x", t, (int)RoadMapMainIo[i].callback ); else printf("In roadmap_main_input_ready, too long! %d 0x%x", t, (int)RoadMapMainIo[i].callback ); } break; } } }