Beispiel #1
0
int sched_init(void)
{
    /* Start main process, which uses the main kernel stack.
     */
    int main_id = process_spawn(
        (uintptr_t)kernel_main,
        kernel_directory,
        0,
        (uintptr_t)__stack_bottom__,
        STACK_SIZE,
        PROCESS_FLAGS_SUPERVISOR
    );
    if (main_id < 0) {
        panic("unable to spawn main process");
    }
    /* Start idle process, which gets its own stack.
     */
    int idle_id = process_spawn(
        (uintptr_t)idle,
        kernel_directory,
        0,
        0,
        STACK_SIZE,
        PROCESS_FLAGS_SUPERVISOR
    );
    if (idle_id < 0) {
        panic("unable to spawn idle process");
    }
    add_timer_event("switch", SCHED_PERIOD, process_switch, &cpu_state);
    return 0;
}
Beispiel #2
0
void c_link::start_timer(timer_event_t evt, uint32_t time)
{
	if( !m_grp )
	{
		return;
	}
	m_timer_event = evt;
	int val;
	m_timer_id = add_timer_event(&m_timer, on_game_timer_expire, m_grp, &val, now.tv_sec + time );
	m_timer_counter = 1;
}
Beispiel #3
0
void AngelFight::BeginTimer(TIMER_EVENT evt,uint32_t time)
{
    //DEBUG_LOG( "AngelFight::BeginTimer Event:[%d], Timer:[%u]second", int32_t(evt), time );
    if( !m_pGrp )
    {
        return;
    }
    m_nTimerEvent = evt;
    int val;
    m_nTimerID = add_timer_event(&m_timer, on_game_timer_expire, m_pGrp, &val, now.tv_sec + time );
    m_nTimerCounter = m_nPlayerCount;
    //DEBUG_LOG( "Add Timer Event OK ID:[%d]", m_nTimerID );
}