Changeset 31e8ddd in mainline for generic/src/proc/task.c


Ignore:
Timestamp:
2006-06-05T17:25:37Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2569ec90
Parents:
9c1c6771
Message:

task_destroy() implementation, fixes in as_destroy() and task_kill().
This is the first version of HelenOS that would perform complete cleanup leading from thread to destruction of address space.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/proc/task.c

    r9c1c6771 r31e8ddd  
    141141void task_destroy(task_t *t)
    142142{
     143        spinlock_lock(&tasks_lock);
     144        btree_remove(&tasks_btree, t->taskid, NULL);
     145        spinlock_unlock(&tasks_lock);
     146
     147        task_destroy_arch(t);
     148        btree_destroy(&t->futexes);
     149
     150        mutex_lock_active(&t->as->lock);
     151        if (--t->as->refcount == 0) {
     152                mutex_unlock(&t->as->lock);
     153                as_destroy(t->as);
     154                /*
     155                 * t->as is destroyed.
     156                 */
     157        } else {
     158                mutex_unlock(&t->as->lock);
     159        }
     160       
     161        free(t);
     162        TASK = NULL;
    143163}
    144164
     
    259279        ta->refcount++;
    260280        spinlock_unlock(&ta->lock);
     281
     282        spinlock_unlock(&tasks_lock);
    261283       
    262284        t = thread_create(ktaskclnp, NULL, ta, 0, "ktaskclnp");
Note: See TracChangeset for help on using the changeset viewer.