/** Our implementation of exit(). For DDE purposes this only relates * to kernel threads. */ void do_exit(long code) { ddekit_thread_t *t = DDEKIT_THREAD(lxtask_to_ddethread(current)); // printk("Thread %s exits with code %x\n", ddekit_thread_get_name(t), code); /* do some cleanup */ detach_pid(current, 0); /* goodbye, cruel world... */ ddekit_thread_exit(); }
/*** * try_to_wake_up - wake up a thread * @p: the to-be-woken-up thread * @state: the mask of task states that can be woken * @sync: do a synchronous wakeup? */ int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) { Assert(p); dde26_thread_data *t = lxtask_to_ddethread(p); Assert(t); Assert(SLEEP_LOCK(t)); p->state = TASK_RUNNING; ddekit_sem_up(SLEEP_LOCK(t)); return 0; }
/* Our version of scheduler invocation. * * Scheduling is performed by Fiasco, so we don't care about it as long as * a thread is running. If a task becomes TASK_INTERRUPTIBLE or * TASK_UNINTERRUPTIBLE, we make sure that the task does not become * scheduled by locking the task's sleep lock. */ asmlinkage void schedule(void) { dde26_thread_data *t = lxtask_to_ddethread(current); switch (current->state) { case TASK_RUNNING: ddekit_thread_schedule(); break; case TASK_INTERRUPTIBLE: case TASK_UNINTERRUPTIBLE: ddekit_sem_down(SLEEP_LOCK(t)); break; default: panic("current->state = %d --- unknown state\n", current->state); } }