/kernel/trunk/generic/include/proc/task.h |
---|
92,6 → 92,10 |
extern void task_create_arch(task_t *t); |
#endif |
#ifndef task_destroy_arch |
extern void task_destroy_arch(task_t *t); |
#endif |
extern __native sys_task_get_id(task_id_t *uspace_task_id); |
#endif |
/kernel/trunk/generic/src/proc/task.c |
---|
140,6 → 140,26 |
*/ |
void task_destroy(task_t *t) |
{ |
spinlock_lock(&tasks_lock); |
btree_remove(&tasks_btree, t->taskid, NULL); |
spinlock_unlock(&tasks_lock); |
task_destroy_arch(t); |
btree_destroy(&t->futexes); |
mutex_lock_active(&t->as->lock); |
if (--t->as->refcount == 0) { |
mutex_unlock(&t->as->lock); |
as_destroy(t->as); |
/* |
* t->as is destroyed. |
*/ |
} else { |
mutex_unlock(&t->as->lock); |
} |
free(t); |
TASK = NULL; |
} |
/** Create new task with 1 thread and run it |
258,6 → 278,8 |
spinlock_lock(&ta->lock); |
ta->refcount++; |
spinlock_unlock(&ta->lock); |
spinlock_unlock(&tasks_lock); |
t = thread_create(ktaskclnp, NULL, ta, 0, "ktaskclnp"); |
/kernel/trunk/generic/src/mm/as.c |
---|
147,8 → 147,10 |
ipl = interrupts_disable(); |
spinlock_lock(&inactive_as_with_asid_lock); |
if (as->asid != ASID_INVALID && as->asid != ASID_KERNEL) { |
list_remove(&as->inactive_as_with_asid_link); |
if (as->asid != ASID_INVALID && as != AS_KERNEL) { |
if (!as->cpu_refcount) |
list_remove(&as->inactive_as_with_asid_link); |
asid_put(as->asid); |
} |
spinlock_unlock(&inactive_as_with_asid_lock); |