Exiting tasks use EXITING signal and change states to TASK_DEAD

This commit is contained in:
Bahadir Balban
2009-10-31 23:13:19 +02:00
parent 5ed93b6563
commit 850c645d77
9 changed files with 54 additions and 5 deletions

View File

@@ -437,6 +437,11 @@ struct capability *cap_match_thread(struct capability *cap,
if (!(cap->access & CAP_TCTRL_RECYCLE))
return 0;
break;
case THREAD_WAIT:
if (!(cap->access & CAP_TCTRL_WAIT))
return 0;
break;
default:
/* We refuse to accept anything else */
return 0;

View File

@@ -225,6 +225,22 @@ void sched_resume_async(struct ktcb *task)
RQ_ADD_FRONT);
}
/* Same as suspend, task state and flags are different */
void sched_exit_sync(void)
{
preempt_disable();
sched_rq_remove_task(current);
current->state = TASK_DEAD;
current->flags &= ~TASK_EXITING;
preempt_enable();
if (current->pagerid != current->tid)
wake_up(&current->wqh_pager, 0);
schedule();
}
/*
* NOTE: Could do these as sched_prepare_suspend()
* + schedule() or need_resched = 1