Changeset 31e8ddd in mainline


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:
9c1c677
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.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/proc/task.c

    r9c1c677 r31e8ddd  
    2828
    2929#include <proc/task.h>
     30#include <mm/slab.h>
    3031#include <arch/types.h>
    3132
     
    3940        bitmap_initialize(&t->arch.iomap, NULL, 0);
    4041}
     42
     43/** Perform amd64 specific task destruction.
     44 *
     45 * @param t Task to be initialized.
     46 */
     47void task_destroy_arch(task_t *t)
     48{
     49        if (t->arch.iomap.map)
     50                free(t->arch.iomap.map);
     51}
  • arch/ia32/src/proc/task.c

    r9c1c677 r31e8ddd  
    3030#include <arch/types.h>
    3131#include <adt/bitmap.h>
     32#include <mm/slab.h>
    3233
    3334/** Perform ia32 specific task initialization.
     
    4041        bitmap_initialize(&t->arch.iomap, NULL, 0);
    4142}
     43
     44/** Perform ia32 specific task destruction.
     45 *
     46 * @param t Task to be initialized.
     47 */
     48void task_destroy_arch(task_t *t)
     49{
     50        if (t->arch.iomap.map)
     51                free(t->arch.iomap.map);
     52}
  • arch/ia64/include/proc/task.h

    r9c1c677 r31e8ddd  
    3434
    3535#define task_create_arch(t)
     36#define task_destroy_arch(t)
    3637
    3738#endif
  • arch/mips32/include/proc/task.h

    r9c1c677 r31e8ddd  
    3434
    3535#define task_create_arch(t)
     36#define task_destroy_arch(t)
    3637
    3738#endif
  • arch/ppc32/include/proc/task.h

    r9c1c677 r31e8ddd  
    3434
    3535#define task_create_arch(t)
     36#define task_destroy_arch(t)
    3637
    3738#endif
  • arch/ppc64/include/proc/task.h

    r9c1c677 r31e8ddd  
    3434
    3535#define task_create_arch(t)
     36#define task_destroy_arch(t)
    3637
    3738#endif
  • arch/sparc64/include/proc/task.h

    r9c1c677 r31e8ddd  
    3434
    3535#define task_create_arch(t)
     36#define task_destroy_arch(t)
    3637
    3738#endif
  • generic/include/proc/task.h

    r9c1c677 r31e8ddd  
    9393#endif
    9494
     95#ifndef task_destroy_arch
     96extern void task_destroy_arch(task_t *t);
     97#endif
     98
    9599extern __native sys_task_get_id(task_id_t *uspace_task_id);
    96100
  • generic/src/mm/as.c

    r9c1c677 r31e8ddd  
    148148        ipl = interrupts_disable();
    149149        spinlock_lock(&inactive_as_with_asid_lock);
    150         if (as->asid != ASID_INVALID && as->asid != ASID_KERNEL) {
    151                 list_remove(&as->inactive_as_with_asid_link);
     150
     151        if (as->asid != ASID_INVALID && as != AS_KERNEL) {
     152                if (!as->cpu_refcount)
     153                        list_remove(&as->inactive_as_with_asid_link);
    152154                asid_put(as->asid);
    153155        }
  • generic/src/proc/task.c

    r9c1c677 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.