From 2839f46245e9836546bf29eaf5ffc403a893bad4 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Fri, 30 Oct 2009 21:59:46 +0200 Subject: [PATCH] Cleanup on previous commits --- conts/posix/mm0/main.c | 4 +-- src/generic/scheduler.c | 73 ++--------------------------------------- src/lib/mutex.c | 4 --- 3 files changed, 4 insertions(+), 77 deletions(-) diff --git a/conts/posix/mm0/main.c b/conts/posix/mm0/main.c index 3c1ee2d..d5514f7 100644 --- a/conts/posix/mm0/main.c +++ b/conts/posix/mm0/main.c @@ -140,12 +140,12 @@ void handle_requests(void) break; } case L4_IPC_TAG_EXIT: { + /* Pager exit test struct task_ids ids; - l4_getid(&ids); - printf("\n%s: Destroying self (%d), along with any tasks.\n", __TASKNAME__, self_tid()); l4_thread_control(THREAD_DESTROY, &ids); + */ /* An exiting task has no receive phase */ sys_exit(sender, (int)mr[0]); diff --git a/src/generic/scheduler.c b/src/generic/scheduler.c index e26ced3..b69a92a 100644 --- a/src/generic/scheduler.c +++ b/src/generic/scheduler.c @@ -232,7 +232,7 @@ void sched_resume_async(struct ktcb *task) */ void sched_pager_exit(void) { - printk("Pager (%d) Exiting...\n", current->tid); + // printk("Pager (%d) Exiting...\n", current->tid); /* Remove from its list, callers get -ESRCH */ tcb_remove(current); @@ -251,7 +251,7 @@ void sched_pager_exit(void) preempt_disable(); /* - * TOO LONG! + * FIXME: TOO LONG! */ tcb_delete(current); @@ -266,75 +266,6 @@ void sched_pager_exit(void) BUG(); } -#if 0 -/* - * A paged-thread leaves the system and waits on - * its pager's task_dead queue. - */ -void sched_die_child(void) -{ - int locked; - - /* - * Find pager, he _must_ be there because he never - * quits before quitting us - */ - struct ktcb *pager = tcb_find(current->pagerid); - - do { - /* Busy spin without disabling preemption */ - locked = mutex_trylock(&pager->task_dead_mutex); - } while (!locked); - - /* Remove from container task list, - * callers get -ESRCH */ - tcb_remove(current); - - /* - * If the pager searches for us to destroy, - * he won't find us but he will block on the - * task_dead mutex when searching whether - * we died already. - */ - - /* - * If there are any sleepers on any of the task's - * waitqueues, we need to wake those tasks up. - */ - wake_up_all(¤t->wqh_send, 0); - wake_up_all(¤t->wqh_recv, 0); - - /* - * Add self to pager's dead tasks list, - * to be deleted by pager - */ - list_insert(¤t->task_list, &pager->task_dead_list); - - /* Now quit the scheduler */ - preempt_disable(); - sched_rq_remove_task(current); - current->state = TASK_INACTIVE; - current->flags &= ~TASK_SUSPENDING; - scheduler.prio_total -= current->priority; - BUG_ON(scheduler.prio_total < 0); - preempt_enable(); - - /* - * Clear pager waitqueue in case it issued - * a suspend on us (for any reason) - */ - wake_up(¤t->wqh_pager, 0); - - /* - * Unlock task_dead queue, - * pager can safely delete us - */ - mutex_unlock(&pager->task_dead_mutex); - schedule(); - BUG(); -} -#endif - void sched_exit_sync(void) { struct ktcb *pager = tcb_find(current->pagerid); diff --git a/src/lib/mutex.c b/src/lib/mutex.c index c635403..1a0bed0 100644 --- a/src/lib/mutex.c +++ b/src/lib/mutex.c @@ -117,7 +117,6 @@ int mutex_lock(struct mutex *mutex) * undeterministic as to how many retries will result in success. * We may need to add priority-based locking. */ - //printk("Thread (%d) locking (%p) nlocks: %d\n", current->tid, mutex, current->nlocks); for (;;) { spin_lock(&mutex->wqh.slock); if (!__mutex_lock(&mutex->lock)) { /* Could not lock, sleep. */ @@ -132,7 +131,6 @@ int mutex_lock(struct mutex *mutex) /* Did we wake up normally or get interrupted */ if (current->flags & TASK_INTERRUPTED) { - //printk("XXXXXXXXXXXXXXXX (%d) Interrupted\n", current->tid); current->flags &= ~TASK_INTERRUPTED; return -EINTR; } @@ -142,14 +140,12 @@ int mutex_lock(struct mutex *mutex) } } spin_unlock(&mutex->wqh.slock); - //printk("Thread (%d) locked (%p) nlocks: %d\n", current->tid, mutex, current->nlocks); return 0; } static inline void mutex_unlock_common(struct mutex *mutex, int sync) { struct ktcb *c = current; if (c); - //printk("Thread (%d) unlocking (%p) nlocks: %d\n", c->tid, mutex, c->nlocks); spin_lock(&mutex->wqh.slock); __mutex_unlock(&mutex->lock); current->nlocks--;