summaryrefslogtreecommitdiff
path: root/src/kernel/task/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/task/task.c')
-rw-r--r--src/kernel/task/task.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/kernel/task/task.c b/src/kernel/task/task.c
index d8670a0..68cb249 100644
--- a/src/kernel/task/task.c
+++ b/src/kernel/task/task.c
@@ -17,8 +17,6 @@ static void thread_exit2(uint32_t reason);
static void thread_delete(struct thread *th);
static void process_delete(struct process *pr);
-static uint32_t thread_runnable(struct thread *th);
-
//From task_.asm
extern uint32_t read_eip();
extern void task_idle(void*);
@@ -65,7 +63,7 @@ static struct thread *thread_next() {
while (1) {
ret = ret->next;
if (ret == 0) ret = threads;
- if (thread_runnable(ret)) {
+ if (ret->state == TS_RUNNING) {
return ret;
}
if (ret == current_thread) {
@@ -141,14 +139,6 @@ uint32_t tasking_handleException(struct registers *regs) {
return 0;
}
-/* Makes the current thread sleep. */
-void thread_sleep(uint32_t msecs) {
- if (current_thread == 0) return;
- current_thread->state = TS_SLEEPING;
- current_thread->timeWait = timer_time() + msecs;
- tasking_switch();
-}
-
/* Puts the current thread in an inactive state. */
void thread_goInactive() {
current_thread->state = TS_WAKEWAIT;
@@ -215,16 +205,6 @@ void process_exit(uint32_t retval) {
thread_exit_stackJmp(retval);
}
-/* Nonzero if given thread is not in a waiting state. */
-static uint32_t thread_runnable(struct thread *t) {
- if (t->state == TS_RUNNING) return 1;
- if (t->state == TS_SLEEPING && timer_time() >= t->timeWait) {
- t->state = TS_RUNNING;
- return 1;
- }
- return 0;
-}
-
/* For internal use only. This is called when a newly created thread first runs
(its address is the value given for EIP).
It switches to user mode if necessary and calls the entry point. */