コード例 #1
0
ファイル: encoder.cpp プロジェクト: hundeboll/fox
void encoder::init()
{
    guard g(m_lock);

    set_group("encoder");
    set_state(STATE_WAIT);
    init_timeout(FLAGS_encoder_timeout);

    /* allocate memory for encoder */
    if (!m_symbol_storage)
        m_symbol_storage = new uint8_t[this->block_size()];

    /* reset counters */
    m_plain_pkt_count = 0;
    m_enc_pkt_count = 0;
    m_last_req_seq = 0;
    m_type = ENC_PACKET;

    m_io->read_link(_key.dst);
    m_io->read_one_hops(_key.dst);

    helper_msg best_helper = m_io->get_best_one_hop(_key.dst);
    m_io->read_link(best_helper.addr);

    /*
    e1 = ONE - m_io->get_link(best_helper.addr);
    e2 = ONE - best_helper.tq_second_hop * 4.5; // Scale to revert hop penalty
    e3 = ONE - m_io->get_link(_key.dst);
    */

    m_max_budget = source_budget(this->symbols(), m_e1, m_e2, m_e3);
    VLOG(LOG_GEN) << "Encoder " << m_coder << ": Initialized (B: "
                  << m_max_budget << ") " << _key;
}
コード例 #2
0
ファイル: server_stt.c プロジェクト: Surogate/epi-pizza
static void	end_loop(t_svr_vector *vec, t_select *slt_par, 
			 t_game *game, int svr_sock)
{
  execute_action(vec, game);
  init_svr_par(slt_par, vec, svr_sock);
  init_timeout(vec, slt_par);
}
コード例 #3
0
ファイル: recoder.cpp プロジェクト: hundeboll/fox
void recoder::init()
{
    guard g(m_lock);

    set_group("recoder");
    set_state(STATE_WAIT);
    init_timeout(FLAGS_recoder_timeout);

    /* reset counters */
    m_budget = 0;
    m_rec_pkt_count = 0;

    m_io->read_one_hops(_key.dst);
    helper_msg best_helper = m_io->get_best_one_hop(_key.dst);
    if (best_helper.tq_total == 0) {
        VLOG(LOG_GEN) << "Recoder " << m_coder << ": No best one hop";
        m_max_budget = this->symbols()*FLAGS_fixed_overshoot;
        return;
    }

    m_io->read_link(best_helper.addr);
    m_io->read_link(_key.dst);
    e1 = ONE - m_io->get_link(best_helper.addr);
    e2 = ONE - best_helper.tq_second_hop * 4.5;  // Scale to revert hop penalty
    e3 = ONE - m_io->get_link(_key.dst);

    if (e1 == ONE || e2 == ONE || e3 == ONE) {
        VLOG(LOG_GEN) << "Recoder " << m_coder << ": Missing link estimate";
        m_max_budget = this->symbols()*FLAGS_fixed_overshoot;
        return;
    }

    m_max_budget = recoder_budget(this->symbols(), e1, e2, e3);
    VLOG(LOG_GEN) << "Recoder " << m_coder << ": Initialized" << _key;
}
コード例 #4
0
ファイル: allmain.c プロジェクト: ictxiangxin/LoongHack
void startup_common(const char *name, int playmode)
{
    /* (re)init all global data */
    init_data();
    init_tutorial();
    init_timeout();
    init_shop_selection();
    reset_food(); /* zero out victual and tin */
    reset_steal();
    reset_dig_status();
    reset_encumber_msg();
    reset_occupations();

    /* create mutable copies of object and artifact liss */
    init_objlist();
    init_artilist();
    reset_rndmonst(NON_PM);
    free_dungeon(); /* clean up stray dungeon data */

    program_state.game_running = 0;
    initoptions();

    dlb_init();	/* must be before newgame() */

    /*
     * Initialization of the boundaries of the mazes
     * Both boundaries have to be even.
     */
    x_maze_max = COLNO-1;
    if (x_maze_max % 2)
	x_maze_max--;
    y_maze_max = ROWNO-1;
    if (y_maze_max % 2)
	y_maze_max--;

    /*
	*  Initialize the vision system.  This must be before mklev() on a
	*  new game or before a level restore on a saved game.
	*/
    vision_init();
    
    if (playmode == MODE_TUTORIAL)
	flags.tutorial = TRUE;
    if (playmode == MODE_EXPLORE)
	discover = TRUE;
    else if (playmode == MODE_WIZARD)
	wizard = TRUE;
    
    if (name && name[0]) {
	strncpy(plname, name, PL_NSIZ);
	plname[PL_NSIZ-1] = '\0';
    }

    if (wizard)
	strcpy(plname, "巫师");

    cls();

    initrack();
}
コード例 #5
0
ファイル: main.c プロジェクト: m8t/xfce4-taskmanager
static void
refresh_rate_changed (void)
{
    if (!g_source_remove (timeout))
    {
        g_critical ("Unable to remove source");
        return;
    }
    timeout = 0;
    init_timeout ();
}
コード例 #6
0
ファイル: test_timeout.c プロジェクト: polazarus/ocamlyices2
int main(void) {
  uint32_t n;
  uint32_t time;

  init_timeout();

  time = 20;
  for (n=5; n<40; n++) {
    test_timeout(counter, n, time);
  }

  delete_timeout();

  return 0;
}
コード例 #7
0
ファイル: decoder.cpp プロジェクト: hundeboll/fox
void decoder::init()
{
    guard g(m_lock);

    set_group("decoder");
    set_state(STATE_WAIT);
    init_timeout(FLAGS_decoder_timeout);
    set_pkt_timeout(FLAGS_packet_timeout);

    /* Reset list of decoded packets. */
    m_decoded_symbols.resize(this->symbols());
    std::fill(m_decoded_symbols.begin(), m_decoded_symbols.end(), false);

    m_enc_pkt_count = 0;
    m_red_pkt_count = 0;
    m_req_seq = 1;
    VLOG(LOG_GEN) << "Decoder " << m_coder << ": Initialized " << _key;
}
コード例 #8
0
ファイル: main.c プロジェクト: m8t/xfce4-taskmanager
int main (int argc, char *argv[])
{
#ifdef ENABLE_NLS
    bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);
#endif

    gtk_init (&argc, &argv);
    g_set_application_name (_("Task Manager"));

    settings = xtm_settings_get_default ();

    status_icon = gtk_status_icon_new_from_icon_name ("utilities-system-monitor");
    show_hide_status_icon ();
    g_signal_connect (status_icon, "activate", G_CALLBACK (status_icon_activated), NULL);
    g_signal_connect (status_icon, "popup-menu", G_CALLBACK (status_icon_popup_menu), NULL);

    window = xtm_process_window_new ();
    gtk_widget_show (window);

    task_manager = xtm_task_manager_new (xtm_process_window_get_model (XTM_PROCESS_WINDOW (window)));
    g_message ("Running as %s on %s", xtm_task_manager_get_username (task_manager), xtm_task_manager_get_hostname (task_manager));

    init_timeout ();
    g_signal_connect (settings, "notify::refresh-rate", G_CALLBACK (refresh_rate_changed), NULL);
    g_signal_connect_after (settings, "notify::more-precision", G_CALLBACK (force_timeout_update), NULL);
    g_signal_connect_after (settings, "notify::full-command-line", G_CALLBACK (force_timeout_update), NULL);
    g_signal_connect (settings, "notify::show-status-icon", G_CALLBACK (show_hide_status_icon), NULL);

    g_signal_connect (window, "destroy", G_CALLBACK (destroy_window), NULL);
    g_signal_connect (window, "delete-event", G_CALLBACK (delete_window), NULL);

    gtk_main ();

    if (timeout > 0)
        g_source_remove (timeout);
    g_object_unref (window);
    g_object_unref (status_icon);
    g_object_unref (task_manager);
    g_object_unref (settings);

    return 0;
}
コード例 #9
0
ファイル: startup.c プロジェクト: openmach/openmach
/*
 *	Running in virtual memory, on the interrupt stack.
 *	Does not return.  Dispatches initial thread.
 *
 *	Assumes that master_cpu is set.
 */
void setup_main()
{
	thread_t		startup_thread;

	panic_init();
	printf_init();

	sched_init();
	vm_mem_bootstrap();
	ipc_bootstrap();
	vm_mem_init();
	ipc_init();

	/*
	 * As soon as the virtual memory system is up, we record
	 * that this CPU is using the kernel pmap.
	 */
	PMAP_ACTIVATE_KERNEL(master_cpu);

	init_timers();
	init_timeout();

#if	XPR_DEBUG
	xprbootstrap();
#endif	XPR_DEBUG

	timestamp_init();

	mapable_time_init();

	machine_init();

	machine_info.max_cpus = NCPUS;
	machine_info.memory_size = phys_last_addr - phys_first_addr; /* XXX mem_size */
	machine_info.avail_cpus = 0;
	machine_info.major_version = KERNEL_MAJOR_VERSION;
	machine_info.minor_version = KERNEL_MINOR_VERSION;

	/*
	 *	Initialize the IPC, task, and thread subsystems.
	 */
	task_init();
	thread_init();
	swapper_init();
#if	MACH_HOST
	pset_sys_init();
#endif	MACH_HOST

	/*
	 *	Kick off the time-out driven routines by calling
	 *	them the first time.
	 */
	recompute_priorities();
	compute_mach_factor();
	
	/*
	 *	Create a kernel thread to start the other kernel
	 *	threads.  Thread_resume (from kernel_thread) calls
	 *	thread_setrun, which may look at current thread;
	 *	we must avoid this, since there is no current thread.
	 */

	/*
	 * Create the thread, and point it at the routine.
	 */
	(void) thread_create(kernel_task, &startup_thread);
	thread_start(startup_thread, start_kernel_threads);

	/*
	 * Give it a kernel stack.
	 */
	thread_doswapin(startup_thread);

	/*
	 * Pretend it is already running, and resume it.
	 * Since it looks as if it is running, thread_resume
	 * will not try to put it on the run queues.
	 *
	 * We can do all of this without locking, because nothing
	 * else is running yet.
	 */
	startup_thread->state |= TH_RUN;
	(void) thread_resume(startup_thread);

	/*
	 * Start the thread.
	 */
	cpu_launch_first_thread(startup_thread);
	/*NOTREACHED*/
}
コード例 #10
0
ファイル: main.c プロジェクト: m8t/xfce4-taskmanager
static void
force_timeout_update (void)
{
    init_timeout ();
}