예제 #1
0
파일: sched.c 프로젝트: mduft/tachyon3
static bool sched_syscall_handler(interrupt_t* state) {
    switch(sysc_get_call(state)) {
    case SysSchedule:
        sysc_call(state, (syscall_handler_t)sched_schedule);
        return true;
    case SysYield:
        sysc_call(state, (syscall_handler_t)sched_yield);
        return true;
    default:
        return false;
    }
}
예제 #2
0
파일: sched.c 프로젝트: bartman/tachyon3
void sched_yield() {
    thread_t * thr = thr_current();
    thr->state = Yielded;

    sysc_call(SysSchedule, 0, 0);

    return;
}
예제 #3
0
파일: thread.c 프로젝트: bartman/tachyon3
void thr_trampoline(thread_t* thread, thread_start_t entry) {
    entry();

    thread->state = Exited;
    
    trace("thread %d in process %d exited\n", thread->id, thread->parent->id);

    sysc_call(SysSchedule, 0, 0);

    /* never reached - as the thread is aborting, it will never be re-scheduled */
}
예제 #4
0
파일: thread.c 프로젝트: bartman/tachyon3
void thr_abort(thread_t* target) {
    target->state = Aborting;

    error("thread %d in process %d aborted!\n", target->id, target->parent->id);

    list_t* trace = ksym_trace();
    ksym_write_trace(Error, trace);
    ksym_delete(trace);

    sysc_call(SysSchedule, 0, 0);

    /* never reached - as the thread is aborting, it will never be re-scheduled */
}